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:
parent
2b9d216ffc
commit
ca64e9d85f
|
@ -403,6 +403,7 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
|
||||||
Helper routine for calling PostGIS functions and returning their result.
|
Helper routine for calling PostGIS functions and returning their result.
|
||||||
"""
|
"""
|
||||||
cursor = self.connection._cursor()
|
cursor = self.connection._cursor()
|
||||||
|
try:
|
||||||
try:
|
try:
|
||||||
cursor.execute('SELECT %s()' % func)
|
cursor.execute('SELECT %s()' % func)
|
||||||
row = cursor.fetchone()
|
row = cursor.fetchone()
|
||||||
|
|
|
@ -210,11 +210,12 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
|
||||||
Helper routine for calling PostGIS functions and returning their result.
|
Helper routine for calling PostGIS functions and returning their result.
|
||||||
"""
|
"""
|
||||||
cursor = self.connection._cursor()
|
cursor = self.connection._cursor()
|
||||||
|
try:
|
||||||
try:
|
try:
|
||||||
cursor.execute('SELECT %s()' % func)
|
cursor.execute('SELECT %s()' % func)
|
||||||
row = cursor.fetchone()
|
row = cursor.fetchone()
|
||||||
except:
|
except:
|
||||||
# TODO: raise helpful exception here.
|
# Responsibility of caller to perform error handling.
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
Loading…
Reference in New Issue