Author: russellm Date: 2010-02-26 10:11:25 -0600 (Fri, 26 Feb 2010) New Revision: 12605
Modified: django/trunk/django/db/backends/postgresql/base.py django/trunk/django/db/backends/postgresql_psycopg2/base.py Log: Corrected an edge case introduced in r12602. Thanks to Ramiro Morales for the eagle eyes. Modified: django/trunk/django/db/backends/postgresql/base.py =================================================================== --- django/trunk/django/db/backends/postgresql/base.py 2010-02-26 15:54:37 UTC (rev 12604) +++ django/trunk/django/db/backends/postgresql/base.py 2010-02-26 16:11:25 UTC (rev 12605) @@ -116,9 +116,11 @@ self.validation = BaseDatabaseValidation(self) def _cursor(self): + new_connection = False set_tz = False settings_dict = self.settings_dict if self.connection is None: + new_connection = True set_tz = settings_dict.get('TIME_ZONE') if settings_dict['NAME'] == '': from django.core.exceptions import ImproperlyConfigured @@ -136,8 +138,9 @@ self.connection.set_isolation_level(1) # make transactions transparent to all cursors connection_created.send(sender=self.__class__) cursor = self.connection.cursor() - if set_tz: - cursor.execute("SET TIME ZONE %s", [settings_dict['TIME_ZONE']]) + if new_connection: + if set_tz: + cursor.execute("SET TIME ZONE %s", [settings_dict['TIME_ZONE']]) if not hasattr(self, '_version'): self.__class__._version = get_version(cursor) if self._version[0:2] < (8, 0): Modified: django/trunk/django/db/backends/postgresql_psycopg2/base.py =================================================================== --- django/trunk/django/db/backends/postgresql_psycopg2/base.py 2010-02-26 15:54:37 UTC (rev 12604) +++ django/trunk/django/db/backends/postgresql_psycopg2/base.py 2010-02-26 16:11:25 UTC (rev 12605) @@ -110,9 +110,11 @@ self.validation = BaseDatabaseValidation(self) def _cursor(self): + new_connection = False set_tz = False settings_dict = self.settings_dict if self.connection is None: + new_connection = True set_tz = settings_dict.get('TIME_ZONE') if settings_dict['NAME'] == '': from django.core.exceptions import ImproperlyConfigured @@ -137,8 +139,9 @@ connection_created.send(sender=self.__class__) cursor = self.connection.cursor() cursor.tzinfo_factory = None - if set_tz: - cursor.execute("SET TIME ZONE %s", [settings_dict['TIME_ZONE']]) + if new_connection: + if set_tz: + cursor.execute("SET TIME ZONE %s", [settings_dict['TIME_ZONE']]) if not hasattr(self, '_version'): self.__class__._version = get_version(cursor) if self._version[0:2] < (8, 0): -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.