Ticket #3459: settimezone.diff
File settimezone.diff, 1.1 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 set_tz = False 31 32 if self.connection is None: 33 set_tz = 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." … … 45 47 self.connection.set_isolation_level(1) # make transactions transparent to all cursors 46 48 cursor = self.connection.cursor() 47 49 cursor.tzinfo_factory = None 48 cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) 50 if set_tz: 51 cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) 49 52 if settings.DEBUG: 50 53 return util.CursorDebugWrapper(cursor, self) 51 54 return cursor