Author: jbronn
Date: 2010-11-06 11:32:08 -0500 (Sat, 06 Nov 2010)
New Revision: 14475

Modified:
   django/branches/releases/1.2.X/django/contrib/gis/geometry/test_data.py
Log:
[1.2.X] Fix for running GEOS/GDAL tests on Python 2.6 and below.

Backport of r14474 from trunk.

Modified: 
django/branches/releases/1.2.X/django/contrib/gis/geometry/test_data.py
===================================================================
--- django/branches/releases/1.2.X/django/contrib/gis/geometry/test_data.py     
2010-11-06 16:29:19 UTC (rev 14474)
+++ django/branches/releases/1.2.X/django/contrib/gis/geometry/test_data.py     
2010-11-06 16:32:08 UTC (rev 14475)
@@ -23,6 +23,11 @@
     return seq
 
 
+def strconvert(d):
+    "Converts all keys in dictionary to str type."
+    return dict([(str(k), v) for k, v in d.iteritems()])
+
+
 def get_ds_file(name, ext):
     return os.path.join(TEST_DATA,
                         name,
@@ -81,7 +86,7 @@
     """
     def __init__(self, **kwargs):
         for key, value in kwargs.items():
-            setattr(self, key, [TestGeom(**kwargs) for kwargs in value])
+            setattr(self, key, [TestGeom(**strconvert(kw)) for kw in value])
 
 
 class TestDataMixin(object):
@@ -96,5 +101,5 @@
             # Load up the test geometry data from fixture into global.
             gzf = gzip.GzipFile(os.path.join(TEST_DATA, 'geometries.json.gz'))
             geometries = simplejson.loads(gzf.read())
-            GEOMETRIES = TestGeomSet(**geometries)
+            GEOMETRIES = TestGeomSet(**strconvert(geometries))
         return GEOMETRIES

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to