changeset 5219:40dc001594e4

Allow unicode river names
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 11 Mar 2013 15:49:35 +0100
parents 028ff568b196
children 613d2f494728
files flys-backend/contrib/shpimporter/shpimporter.py flys-backend/contrib/shpimporter/utils.py
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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):
--- 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]

http://dive4elements.wald.intevation.org