maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Maposmatic-dev] [PATCH ocitysmap] Bug fix: (1) locale should be of type


From: David MENTRE
Subject: [Maposmatic-dev] [PATCH ocitysmap] Bug fix: (1) locale should be of type <str>. (2) UTF-8 encoding for pgdb call
Date: Tue, 22 Dec 2009 17:30:27 +0100

---
 ocitysmap/i18n.py         |    6 +++---
 ocitysmap/street_index.py |    4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ocitysmap/i18n.py b/ocitysmap/i18n.py
index 75eed3a..6d243a6 100644
--- a/ocitysmap/i18n.py
+++ b/ocitysmap/i18n.py
@@ -47,7 +47,7 @@ class i18n_template_code_CODE(i18n):
     def __init__(self, language, language_path):
         """Install the _() function for the chosen locale other
            object initialisation"""
-        self.language = language
+        self.language = str(language) # FIXME: why do we have unicode here?
         _install_language(language, locale_path)
         
     def language_code(self):
@@ -95,7 +95,7 @@ class i18n_fr_generic(i18n):
     U_ACCENT = re.compile(ur"[úùûüũ]", re.IGNORECASE | re.UNICODE)
 
     def __init__(self, language, locale_path):
-        self.language = language
+        self.language = str(language)
         _install_language(language, locale_path)
 
     def _upper_unaccent_string(self, s):
@@ -121,7 +121,7 @@ class i18n_fr_generic(i18n):
 
 class i18n_generic(i18n):
     def __init__(self, language, locale_path):
-        self.language = language
+        self.language = str(language)
         _install_language(language, locale_path)
 
     def language_code(self):
diff --git a/ocitysmap/street_index.py b/ocitysmap/street_index.py
index 66260c0..16a026c 100644
--- a/ocitysmap/street_index.py
+++ b/ocitysmap/street_index.py
@@ -791,7 +791,9 @@ class OCitySMap:
                               as foo
                               group by amenity, name
                               order by amenity, name;""" % \
-                              (cat, osmid, amenity))
+                              (pgdb.escape_string(cat.encode('utf-8')),
+                               osmid,
+                               amenity))
             sub_al = cursor.fetchall()
             for a in sub_al:
                 if a[1] == None:
-- 
1.6.3.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]