diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2013-07-22 19:04:25 +0100 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2013-07-22 19:04:25 +0100 |
| commit | 03ec3219a04093da6c2e82436cee5c451df4f8aa (patch) | |
| tree | 69e3cc2857b7bc41f269363b0056b361129da118 /django/db/backends/postgresql_psycopg2/base.py | |
| parent | 3a6580e485c11fc5502ffd1bb53347459db43421 (diff) | |
| parent | 29a09b3638e625458b5e07ed0956451432421acf (diff) | |
Merge branch 'master' into schema-alteration
Conflicts:
django/db/backends/mysql/introspection.py
django/db/backends/oracle/creation.py
django/db/backends/postgresql_psycopg2/creation.py
django/db/models/base.py
django/db/models/loading.py
Diffstat (limited to 'django/db/backends/postgresql_psycopg2/base.py')
| -rw-r--r-- | django/db/backends/postgresql_psycopg2/base.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index bf75459b4a..f283476429 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -6,7 +6,9 @@ Requires psycopg 2: http://initd.org/projects/psycopg2 import logging import sys -from django.db.backends import * +from django.conf import settings +from django.db.backends import (BaseDatabaseFeatures, BaseDatabaseWrapper, + BaseDatabaseValidation) from django.db.backends.postgresql_psycopg2.operations import DatabaseOperations from django.db.backends.postgresql_psycopg2.client import DatabaseClient from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation @@ -34,11 +36,13 @@ psycopg2.extensions.register_adapter(SafeText, psycopg2.extensions.QuotedString) logger = logging.getLogger('django.db.backends') + def utc_tzinfo_factory(offset): if offset != 0: raise AssertionError("database connection isn't set to UTC") return utc + class DatabaseFeatures(BaseDatabaseFeatures): needs_datetime_string_cast = False can_return_id_from_insert = True @@ -55,6 +59,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): can_rollback_ddl = True supports_combined_alters = True + class DatabaseWrapper(BaseDatabaseWrapper): vendor = 'postgresql' operators = { @@ -135,7 +140,8 @@ class DatabaseWrapper(BaseDatabaseWrapper): # Set the time zone in autocommit mode (see #17062) self.set_autocommit(True) self.connection.cursor().execute( - self.ops.set_time_zone_sql(), [tz]) + self.ops.set_time_zone_sql(), [tz] + ) self.connection.set_isolation_level(self.isolation_level) def create_cursor(self): |
