Permalink
Browse files

[multi-db] Fixed psycopg2 backend. Removed inheritence from local fro…

…m all backend DatabaseWrappers.

git-svn-id: http://code.djangoproject.com/svn/django/branches/multiple-db-support@3756 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent b87d360 commit eb1357bf48a65c9fe49b3d23df91e6ff2307e684 @jpellerin jpellerin committed Sep 14, 2006
@@ -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
@@ -50,14 +50,8 @@ def __getattr__(self, attr):
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
@@ -13,14 +13,7 @@
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
@@ -13,14 +13,7 @@
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
@@ -13,20 +13,14 @@
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

0 comments on commit eb1357b

Please sign in to comment.