Ticket #5063: reconnect.diff

File reconnect.diff, 778 bytes (added by asderose@…, 17 years ago)

Corrected formatting of previous patch

  • django/db/backends/postgresql_psycopg2/base.py

     
    3131    def cursor(self):
    3232        from django.conf import settings
    3333        set_tz = False
     34       
     35        # psycopg2 closes the DB connection when OperationalError is thrown
     36        # We can test for this by examining connection.closed
     37        # If true we must re-establish the connection.
     38        if self.connection and self.connection.closed:
     39            self.connection = None
     40           
    3441        if self.connection is None:
    3542            set_tz = True
    3643            if settings.DATABASE_NAME == '':
Back to Top