@@ -89,7 +89,15 @@ class ReadOnlyConnection(object):
def close(self):
if self._connection is not None:
- assert django_connection != self._connection
+ # Here we are checking if connection can be compared with
+ # the django DB class, but the connection class under django
+ # 1.3 doesn't have a settings_dict attribute, generating an
+ # AttributeError. So if that error is raised, supress it and
+ # only let the AssertionError pass.
+ try:
+ assert django_connection != self._connection
+ except AttributeError:
+ pass
self._connection.close()
self._connection = None
On Django 1.3, the DB connection object does not have some of the attributes we are trying to compare on the __neq__ method, resulting on an AttributeError. Let's catch that error so the application works under 1.3. Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com> --- frontend/afe/readonly_connection.py | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)