diff options
| author | Justin Bronn <jbronn@gmail.com> | 2009-12-29 11:18:35 +0000 |
|---|---|---|
| committer | Justin Bronn <jbronn@gmail.com> | 2009-12-29 11:18:35 +0000 |
| commit | ca64e9d85f5b08d7deddbf521100e65515edb4de (patch) | |
| tree | 1379f9c2216709c63431201866cd9f95f70a2705 | |
| parent | 2b9d216ffc26834968ec7600a7ae194f0b227318 (diff) | |
Fixed #12458 -- no longer use try/except/finally syntax in PostGIS and SpatiaLite backends as it's incompatible with Python 2.4. Thanks, knutin, for bug report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12026 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/gis/db/backends/postgis/operations.py | 11 | ||||
| -rw-r--r-- | django/contrib/gis/db/backends/spatialite/operations.py | 11 |
2 files changed, 12 insertions, 10 deletions
diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py index 98dab75270..4ae30973f1 100644 --- a/django/contrib/gis/db/backends/postgis/operations.py +++ b/django/contrib/gis/db/backends/postgis/operations.py @@ -404,11 +404,12 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations): """ cursor = self.connection._cursor() try: - cursor.execute('SELECT %s()' % func) - row = cursor.fetchone() - except: - # Responsibility of callers to perform error handling. - raise + try: + cursor.execute('SELECT %s()' % func) + row = cursor.fetchone() + except: + # Responsibility of callers to perform error handling. + raise finally: cursor.close() return row[0] diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py index 7b4e4364ad..f49cf77f3a 100644 --- a/django/contrib/gis/db/backends/spatialite/operations.py +++ b/django/contrib/gis/db/backends/spatialite/operations.py @@ -211,11 +211,12 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations): """ cursor = self.connection._cursor() try: - cursor.execute('SELECT %s()' % func) - row = cursor.fetchone() - except: - # TODO: raise helpful exception here. - raise + try: + cursor.execute('SELECT %s()' % func) + row = cursor.fetchone() + except: + # Responsibility of caller to perform error handling. + raise finally: cursor.close() return row[0] |
