diff options
Diffstat (limited to 'django/db/backends/postgresql/base.py')
| -rw-r--r-- | django/db/backends/postgresql/base.py | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index 9d0967fa2b..0238ce8c57 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -5,7 +5,7 @@ Requires psycopg 1: http://initd.org/projects/psycopg1 """ from django.utils.encoding import smart_str, smart_unicode -from django.db.backends import util +from django.db.backends import BaseDatabaseWrapper, util try: import psycopg as Database except ImportError, e: @@ -15,13 +15,6 @@ except ImportError, e: DatabaseError = Database.DatabaseError IntegrityError = Database.IntegrityError -try: - # Only exists in Python 2.4+ - from threading import local -except ImportError: - # Import copy of _thread_local.py from Python 2.4 - from django.utils._threading_local import local - class UnicodeCursorWrapper(object): """ A thin wrapper around psycopg cursors that allows them to accept Unicode @@ -64,14 +57,8 @@ class UnicodeCursorWrapper(object): postgres_version = None -class DatabaseWrapper(local): - def __init__(self, **kwargs): - self.connection = None - self.queries = [] - self.options = kwargs - - def cursor(self): - from django.conf import settings +class DatabaseWrapper(BaseDatabaseWrapper): + def _cursor(self, settings): set_tz = False if self.connection is None: set_tz = True @@ -98,23 +85,8 @@ class DatabaseWrapper(local): if not postgres_version: cursor.execute("SELECT version()") postgres_version = [int(val) for val in cursor.fetchone()[0].split()[1].split('.')] - if settings.DEBUG: - return util.CursorDebugWrapper(cursor, self) return cursor - def _commit(self): - if self.connection is not None: - return self.connection.commit() - - def _rollback(self): - if self.connection is not None: - return self.connection.rollback() - - def close(self): - if self.connection is not None: - self.connection.close() - self.connection = None - allows_group_by_ordinal = True allows_unique_and_pk = True autoindexes_primary_keys = True |
