Changeset 2581
- Timestamp:
- 03/28/06 11:42:29 (3 years ago)
- Files:
-
- django/branches/magic-removal/django/db/backends/ado_mssql/base.py (modified) (1 diff)
- django/branches/magic-removal/django/db/backends/mysql/base.py (modified) (1 diff)
- django/branches/magic-removal/django/db/backends/postgresql/base.py (modified) (1 diff)
- django/branches/magic-removal/django/db/backends/sqlite3/base.py (modified) (1 diff)
- django/branches/magic-removal/django/utils/_threading_local.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/magic-removal/django/db/backends/ado_mssql/base.py
r2457 r2581 44 44 Database.convertVariantToPython = variantToPython 45 45 46 class DatabaseWrapper: 46 try: 47 # Only exists in Python 2.4+ 48 from threading import local 49 except ImportError: 50 # Import copy of _thread_local.py from Python 2.4 51 from django.utils._threading_local import local 52 53 class DatabaseWrapper(local): 47 54 def __init__(self): 48 55 self.connection = None django/branches/magic-removal/django/db/backends/mysql/base.py
r2516 r2581 47 47 return getattr(self.cursor, attr) 48 48 49 class DatabaseWrapper: 49 try: 50 # Only exists in Python 2.4+ 51 from threading import local 52 except ImportError: 53 # Import copy of _thread_local.py from Python 2.4 54 from django.utils._threading_local import local 55 56 class DatabaseWrapper(local): 50 57 def __init__(self): 51 58 self.connection = None 52 59 self.queries = [] 53 60 61 def _valid_connection(self): 62 if self.connection is not None: 63 try: 64 self.connection.ping() 65 return True 66 except DatabaseError: 67 self.connection.close() 68 self.connection = None 69 return False 70 54 71 def cursor(self): 55 72 from django.conf import settings 56 if self.connection is None:73 if not self._valid_connection(): 57 74 kwargs = { 58 75 'user': settings.DATABASE_USER, django/branches/magic-removal/django/db/backends/postgresql/base.py
r2457 r2581 10 10 DatabaseError = Database.DatabaseError 11 11 12 class DatabaseWrapper: 12 try: 13 # Only exists in Python 2.4+ 14 from threading import local 15 except ImportError: 16 # Import copy of _thread_local.py from Python 2.4 17 from django.utils._threading_local import local 18 19 class DatabaseWrapper(local): 13 20 def __init__(self): 14 21 self.connection = None django/branches/magic-removal/django/db/backends/sqlite3/base.py
r2457 r2581 21 21 return [utf8(r) for r in row] 22 22 23 class DatabaseWrapper: 23 try: 24 # Only exists in Python 2.4+ 25 from threading import local 26 except ImportError: 27 # Import copy of _thread_local.py from Python 2.4 28 from django.utils._threading_local import local 29 30 class DatabaseWrapper(local): 24 31 def __init__(self): 25 32 self.connection = None
