[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH] maposmatic/config: make the GIS database port c
From: |
Thomas Petazzoni |
Subject: |
[Maposmatic-dev] [PATCH] maposmatic/config: make the GIS database port configurable |
Date: |
Sun, 25 Mar 2012 11:32:29 +0200 |
Signed-off-by: Thomas Petazzoni <address@hidden>
---
www/maposmatic/nominatim.py | 5 +++--
www/settings.py | 7 +++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/www/maposmatic/nominatim.py b/www/maposmatic/nominatim.py
index 93641dd..cc83506 100644
--- a/www/maposmatic/nominatim.py
+++ b/www/maposmatic/nominatim.py
@@ -310,11 +310,12 @@ def _prepare_and_filter_entries(entries):
return entries
try:
- conn = psycopg2.connect("dbname='%s' user='%s' host='%s'
password='%s'" %
+ conn = psycopg2.connect("dbname='%s' user='%s' host='%s' password='%s'
port='%s'" %
(www.settings.GIS_DATABASE_NAME,
www.settings.GIS_DATABASE_USER,
www.settings.GIS_DATABASE_HOST,
- www.settings.GIS_DATABASE_PASSWORD))
+ www.settings.GIS_DATABASE_PASSWORD,
+ www.settings.GIS_DATABASE_PORT))
except psycopg2.OperationalError, e:
l.warning("Could not connect to the PostGIS database: %s" %
str(e)[:-1])
diff --git a/www/settings.py b/www/settings.py
index b0d113b..a3d50e1 100644
--- a/www/settings.py
+++ b/www/settings.py
@@ -213,9 +213,11 @@ MAP_LANGUAGES.sort(lambda x, y: cmp(x[1], y[1]))
# "C" must be the last entry
MAP_LANGUAGES.append(("C", _(u"No localization")))
-# GIS database (read settings from OCitySMap's configuration)
+# GIS database (read settings from OCitySMap's configuration). The
+# default port to connect to the database is 5432, which is the
+# default PostgreSQL port.
import ConfigParser
-gis_config = ConfigParser.SafeConfigParser()
+gis_config = ConfigParser.SafeConfigParser({'port': '5432'})
if OCITYSMAP_CFG_PATH is None:
OCITYSMAP_CFG_PATH = os.path.expanduser('~/.ocitysmap.conf')
@@ -225,6 +227,7 @@ GIS_DATABASE_HOST = gis_config.get('datasource', 'host')
GIS_DATABASE_USER = gis_config.get('datasource', 'user')
GIS_DATABASE_PASSWORD = gis_config.get('datasource', 'password')
GIS_DATABASE_NAME = gis_config.get('datasource', 'dbname')
+GIS_DATABASE_PORT = gis_config.get('datasource', 'port')
def has_gis_database():
return GIS_DATABASE_NAME and GIS_DATABASE_NAME != ''
--
1.7.4.1
- [Maposmatic-dev] [PATCH] maposmatic/config: make the GIS database port configurable,
Thomas Petazzoni <=