From 7cbf0ba122d6ee7d90aa841fb2b4fefc94025bc9 Mon Sep 17 00:00:00 2001 From: m431m <m431m@tutanota.com> Date: Wed, 30 May 2018 15:46:39 +0200 Subject: [PATCH] Fixed SQL bugs --- src/mra.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mra.py b/src/mra.py index c236904..5c7bf8c 100644 --- a/src/mra.py +++ b/src/mra.py @@ -28,9 +28,9 @@ Module for managing MapFiles in MRA conceptual model. It deliberately follows a conceptual model close to GeoServer REST - API in order to ensure as much compatibility as possible. And thus + API in order to ensure as much compatibility as possible. And thus allows to switch from first to second. - + But, the next should be (will be) more consistent with MapServer while maintaining a certain proximity with GeoServer... @@ -300,7 +300,7 @@ class Mapfile(MetadataMixin): self.ms.save(path or self.path) def rawtext(self): - open(self.path, "r").read() + open(self.path, "r").read() # Layers: @@ -442,10 +442,10 @@ class FeatureTypeModel(LayerModel): cparam = info["connectionParameters"] if cparam.get("dbtype", None) in ["postgis", "postgres", "postgresql"]: self.ms.connectiontype = mapscript.MS_POSTGIS - connection = "dbname=%s port=%s host=%s " % (cparam["database"], cparam["port"], cparam["host"]) + connection = "dbname=%s port=%s host=%s " % (cparam.get("database", "postgres"), cparam.get("port", "5432"), cparam.get("host", "localhost")) connection += " ".join("%s=%s" % (p, cparam[p]) for p in ["user", "password"] if p in cparam) self.ms.connection = connection - self.ms.data = "%s FROM %s.%s" % (ds[ft_name].get_geometry_column(), cparam["schema"], ft_name) + self.ms.data = '%s FROM %s."%s"' % (ds[ft_name].get_geometry_column(), cparam.get("schema", "public"), ft_name) # self.set_metadata("ows_extent", "%s %s %s %s" % # (ft.get_extent().minX(), ft.get_extent().minY(), # ft.get_extent().maxX(), ft.get_extent().maxY())) -- GitLab