diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2006-11-04 23:29:35 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2006-11-04 23:29:35 +0000 |
| commit | 3e1197f82e4c0ba3c4f7a899d8f60a9ea731504f (patch) | |
| tree | 28eeb9aad48e85b5a223b39ebe5a43cd0e5a91d5 | |
| parent | 2651cf0c7cb1f6cd636dda05730a94ce7b8ea9e3 (diff) | |
[boulder-oracle-sprint] slightly refactored django.db.get_*_module functions.
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@3999 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/db/__init__.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/django/db/__init__.py b/django/db/__init__.py index 4a7f5749d2..b3a06cf3c7 100644 --- a/django/db/__init__.py +++ b/django/db/__init__.py @@ -23,9 +23,17 @@ except ImportError, e: else: raise # If there's some other error, this must be an error in Django itself. -get_introspection_module = lambda: __import__('django.db.backends.%s.introspection' % settings.DATABASE_ENGINE, {}, {}, ['']) -get_creation_module = lambda: __import__('django.db.backends.%s.creation' % settings.DATABASE_ENGINE, {}, {}, ['']) -runshell = lambda: __import__('django.db.backends.%s.client' % settings.DATABASE_ENGINE, {}, {}, ['']).runshell() +def backend_module_accessor(module_name): + def accessor(): + full_name = 'django.db.backends.%s.%s' % (settings.DATABASE_ENGINE, module_name) + return __import__(full_name, {}, {}, ['']) + return accessor + +get_introspection_module = backend_module_accessor("introspection") +get_creation_module = backend_module_accessor("creation") +get_query_module = backend_module_accessor("query") +get_client_module = backend_module_accessor("client") +runshell = lambda: get_client_module().runshell() connection = backend.DatabaseWrapper() DatabaseError = backend.DatabaseError |
