[Commits] python.it commit r258 - code/pythonisti/trunk/pythonisti/geo

commit a svn.python.it commit a svn.python.it
Gio 11 Gen 2007 15:07:11 CET


Author: manlio
Date: Thu Jan 11 15:07:11 2007
New Revision: 258

Modified:
   code/pythonisti/trunk/pythonisti/geo/google.py
   code/pythonisti/trunk/pythonisti/geo/models.py
Log:
Corretta gestione encoding

Modified: code/pythonisti/trunk/pythonisti/geo/google.py
==============================================================================
--- code/pythonisti/trunk/pythonisti/geo/google.py	(original)
+++ code/pythonisti/trunk/pythonisti/geo/google.py	Thu Jan 11 15:07:11 2007
@@ -38,7 +38,7 @@
     info = fp.info()
     content_type = info['content-type']
     charset = _get_charset(content_type) or "utf-8"
-
+    charset = 'iso-8859-1' # XXX Google madness?
     return fp.read().decode(charset)
 
 

Modified: code/pythonisti/trunk/pythonisti/geo/models.py
==============================================================================
--- code/pythonisti/trunk/pythonisti/geo/models.py	(original)
+++ code/pythonisti/trunk/pythonisti/geo/models.py	Thu Jan 11 15:07:11 2007
@@ -21,10 +21,11 @@
 
     def save(self):
         # Setup the computed fields
-        response = google.get_geo_location(self.location)
+        # XXX Django does not supports Unicode
+        response = google.get_geo_location(self.location.decode('utf-8'))
         coordinates = response['Point']['coordinates'][:-1]
 
-        self.address = response['address']
+        self.address = response['address'].encode('utf-8')
         self.geolocation = dumps(coordinates)
         self.geolocation_detail = dumps(response)
         


Maggiori informazioni sulla lista Commits