From eb1357bf48a65c9fe49b3d23df91e6ff2307e684 Mon Sep 17 00:00:00 2001 From: Jason Pellerin Date: Thu, 14 Sep 2006 03:14:39 +0000 Subject: [PATCH] [multi-db] Fixed psycopg2 backend. Removed inheritence from local from all backend DatabaseWrappers. git-svn-id: http://code.djangoproject.com/svn/django/branches/multiple-db-support@3756 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/ado_mssql/base.py | 9 +-------- django/db/backends/mysql/base.py | 8 +------- django/db/backends/oracle/base.py | 9 +-------- django/db/backends/postgresql/base.py | 9 +-------- django/db/backends/postgresql_psycopg2/base.py | 14 ++++---------- 5 files changed, 8 insertions(+), 41 deletions(-) diff --git a/django/db/backends/ado_mssql/base.py b/django/db/backends/ado_mssql/base.py index f62e25c6b2..25832e25df 100644 --- a/django/db/backends/ado_mssql/base.py +++ b/django/db/backends/ado_mssql/base.py @@ -47,14 +47,7 @@ def variantToPython(variant, adType): return res Database.convertVariantToPython = variantToPython -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 DatabaseWrapper(local): +class DatabaseWrapper(object): def __init__(self, settings): self.settings = settings self.connection = None diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index b20cf0a05c..b760f47786 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -50,14 +50,8 @@ class MysqlDebugWrapper: else: return getattr(self.cursor, attr) -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 DatabaseWrapper(local): +class DatabaseWrapper(object): def __init__(self, settings): self.settings = settings self.connection = None diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index 1279cc9699..a9a0662c15 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -13,14 +13,7 @@ except ImportError, e: DatabaseError = Database.Error -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 DatabaseWrapper(local): +class DatabaseWrapper(object): def __init__(self, settings): self.settings = settings self.connection = None diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index 987ab08e15..774b52a1d6 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -13,14 +13,7 @@ except ImportError, e: DatabaseError = Database.DatabaseError -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 DatabaseWrapper(local): +class DatabaseWrapper(object): def __init__(self, settings): self.settings = settings self.connection = None diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index 7c0c9558e9..65f3e698ae 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -13,20 +13,14 @@ except ImportError, e: DatabaseError = Database.DatabaseError -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 DatabaseWrapper(local): - def __init__(self): +class DatabaseWrapper(object): + def __init__(self, settings): + self.settings = settings self.connection = None self.queries = [] def cursor(self): - from django.conf import settings + settings = self.settings if self.connection is None: if settings.DATABASE_NAME == '': from django.core.exceptions import ImproperlyConfigured