Ticket #3460: combined.diff
File combined.diff, 1.5 KB (added by , 18 years ago) |
---|
-
django/db/backends/postgresql_psycopg2/base.py
28 28 29 29 def cursor(self): 30 30 from django.conf import settings 31 first_cursor = False 31 32 if self.connection is None: 33 first_cursor = True 32 34 if settings.DATABASE_NAME == '': 33 35 from django.core.exceptions import ImproperlyConfigured 34 36 raise ImproperlyConfigured, "You need to specify DATABASE_NAME in your Django settings file." … … 42 44 if settings.DATABASE_PORT: 43 45 conn_string += " port=%s" % settings.DATABASE_PORT 44 46 self.connection = Database.connect(conn_string, **self.options) 45 self.connection.set_isolation_level( 1) # make transactions transparent to all cursors47 self.connection.set_isolation_level(0) # autocommit 46 48 cursor = self.connection.cursor() 47 49 cursor.tzinfo_factory = None 48 cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) 50 if first_cursor: 51 cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) 52 cursor.execute("SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED") 53 self._commit() 49 54 if settings.DEBUG: 50 55 return util.CursorDebugWrapper(cursor, self) 51 56 return cursor