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
This commit is contained in:
Justin Bronn 2009-12-29 11:18:35 +00:00
parent 2b9d216ffc
commit ca64e9d85f
2 changed files with 12 additions and 10 deletions

View File

@ -404,11 +404,12 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
""" """
cursor = self.connection._cursor() cursor = self.connection._cursor()
try: try:
cursor.execute('SELECT %s()' % func) try:
row = cursor.fetchone() cursor.execute('SELECT %s()' % func)
except: row = cursor.fetchone()
# Responsibility of callers to perform error handling. except:
raise # Responsibility of callers to perform error handling.
raise
finally: finally:
cursor.close() cursor.close()
return row[0] return row[0]

View File

@ -211,11 +211,12 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
""" """
cursor = self.connection._cursor() cursor = self.connection._cursor()
try: try:
cursor.execute('SELECT %s()' % func) try:
row = cursor.fetchone() cursor.execute('SELECT %s()' % func)
except: row = cursor.fetchone()
# TODO: raise helpful exception here. except:
raise # Responsibility of caller to perform error handling.
raise
finally: finally:
cursor.close() cursor.close()
return row[0] return row[0]