Ticket #16722: psycopg2_import_error.diff

File psycopg2_import_error.diff, 939 bytes (added by Ubercore, 13 years ago)
  • django/db/backends/postgresql_psycopg2/base.py

     
    1919try:
    2020    import psycopg2 as Database
    2121    import psycopg2.extensions
    22     import psycopg2.Error
    2322except ImportError, e:
    2423    from django.core.exceptions import ImproperlyConfigured
    2524    raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
     
    125124        try:
    126125            self.connection.close()
    127126            self.connection = None
    128         except psycopg2.Error:
     127        except Database.Error:
    129128            # In some cases (database restart, network connection lost etc...)
    130129            # the connection to the database is lost without giving Django a
    131130            # notification. If we don't set self.connection to None, the error
Back to Top