From 18e288bb42380ece8e6acf9d206d299815e681fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ma=C3=ABl=20M=C3=A9liani?= <m.meliani@neogeo-online.net>
Date: Thu, 6 Jun 2013 16:02:46 +0200
Subject: [PATCH] Updated GET maps/{mapfile name} response.

---
 src/server.py | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/server.py b/src/server.py
index 40dac32..33c9cd4 100755
--- a/src/server.py
+++ b/src/server.py
@@ -63,18 +63,7 @@ class mapfiles(object):
             filename = mf.filename.replace(".map", "")
             mapfiles.append({
                 "name": filename,
-                "map_full_path": mf.path,
-                "href": "%s/maps/%s.%s" % (web.ctx.home, filename, format),
-                "workspaces": href("%s/maps/%s/workspaces.%s" % (web.ctx.home, filename, format)),
-                "layers": href("%s/maps/%s/layers.%s" % (web.ctx.home, filename, format)),
-                "layergroups": href("%s/maps/%s/layergroups.%s" % (web.ctx.home, filename, format)),
-                "styles": href("%s/maps/%s/styles.%s" % (web.ctx.home, filename, format)),
-                "wms_capabilities": href("%smap=%s&REQUEST=GetCapabilities&VERSION=%s&SERVICE=WMS" % (
-                            get_config("mapserver")["url"], mf.path, get_config("mapserver")["wms_version"])),
-                "wfs_capabilities": href("%smap=%s&REQUEST=GetCapabilities&VERSION=%s&SERVICE=WFS" % (
-                            get_config("mapserver")["url"], mf.path, get_config("mapserver")["wfs_version"])),
-                "wcs_capabilities": href("%smap=%s&REQUEST=GetCapabilities&VERSION=%s&SERVICE=WCS" % (
-                            get_config("mapserver")["url"], mf.path, get_config("mapserver")["wcs_version"])),
+                "href": "%s/maps/%s.%s" % (web.ctx.home, filename, format)
               })
 
         return {"mapfiles": mapfiles}
@@ -99,10 +88,20 @@ class named_mapfile(object):
         mf = get_mapfile(map_name)
         with open(mf.path, "r") as f:
             data = f.read()
-        return {"mapfile":
-                ({
-                    "name": map_name,
-                    "content": data})
+        return {"mapfile": ({
+                "name": map_name,
+                "href": "%s/maps/%s.map" % (web.ctx.home, map_name),
+                "workspaces": href("%s/maps/%s/workspaces.%s" % (web.ctx.home, map_name, format)),
+                "layers": href("%s/maps/%s/layers.%s" % (web.ctx.home, map_name, format)),
+                "layergroups": href("%s/maps/%s/layergroups.%s" % (web.ctx.home, map_name, format)),
+                "styles": href("%s/maps/%s/styles.%s" % (web.ctx.home, map_name, format)),
+                "wms_capabilities": href("%smap=%s&REQUEST=GetCapabilities&VERSION=%s&SERVICE=WMS" % (
+                            get_config("mapserver")["url"], mf.path, get_config("mapserver")["wms_version"])),
+                "wfs_capabilities": href("%smap=%s&REQUEST=GetCapabilities&VERSION=%s&SERVICE=WFS" % (
+                            get_config("mapserver")["url"], mf.path, get_config("mapserver")["wfs_version"])),
+                "wcs_capabilities": href("%smap=%s&REQUEST=GetCapabilities&VERSION=%s&SERVICE=WCS" % (
+                            get_config("mapserver")["url"], mf.path, get_config("mapserver")["wcs_version"])),
+                    })
             } if format != "map" else data
 
     @HTTPCompatible()
-- 
GitLab