[Dive4elements-commits] [PATCH 1 of 4] Allow unicode river names
Wald Commits
scm-commit at wald.intevation.org
Mon Mar 11 16:52:36 CET 2013
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1363013375 -3600
# Node ID 40dc001594e41e91e7d6ef721552063c85cf83a7
# Parent 028ff568b19639ae543e77deadbb6e869ac7707f
Allow unicode river names
diff -r 028ff568b196 -r 40dc001594e4 flys-backend/contrib/shpimporter/shpimporter.py
--- a/flys-backend/contrib/shpimporter/shpimporter.py Mon Mar 11 16:32:20 2013 +0100
+++ b/flys-backend/contrib/shpimporter/shpimporter.py Mon Mar 11 15:49:35 2013 +0100
@@ -22,6 +22,8 @@
logger = logging.getLogger("shpimporter")
+os.environ["NLS_LANG"] = ".AL32UTF8"
+
def initialize_logging(level):
"""Initializes the logging system"""
root = logging.getLogger()
@@ -197,10 +199,11 @@
if not river_id:
logger.info("Could not find river in database. Skipping: %s"
- % river_name)
+ % unicode(utils.getUTF8(river_name)), "UTF-8")
continue
else:
- logger.info("Importing River: %s" % river_name)
+ logger.info(u"Importing River: %s" % unicode(
+ utils.getUTF8(river_name), "UTF-8"))
for importer in getImporters(river_id, dbconn, config.dry_run):
if skip_importer(config, importer):
diff -r 028ff568b196 -r 40dc001594e4 flys-backend/contrib/shpimporter/utils.py
--- a/flys-backend/contrib/shpimporter/utils.py Mon Mar 11 16:32:20 2013 +0100
+++ b/flys-backend/contrib/shpimporter/utils.py Mon Mar 11 15:49:35 2013 +0100
@@ -41,7 +41,7 @@
stmt = SQL_SELECT_RIVER_ID_ORA
else:
stmt = SQL_SELECT_RIVER_ID
- cur.execute(stmt, (name,))
+ cur.execute(stmt, (getUTF8(name),))
row = cur.fetchone()
if row:
return row[0]
More information about the Dive4elements-commits
mailing list