Author: adrian
Date: 2006-05-26 14:02:23 -0500 (Fri, 26 May 2006)
New Revision: 2994
Modified:
django/trunk/django/db/__init__.py
Log:
Improved error message if DATABASE_ENGINE is invalid.
Modified: django/trunk/django/db/__init__.py
===================================================================
--- django/trunk/django/db/__init__.py 2006-05-26 18:58:46 UTC (rev 2993)
+++ django/trunk/django/db/__init__.py 2006-05-26 19:02:23 UTC (rev 2994)
@@ -17,8 +17,11 @@
backend_dir = os.path.join(__path__[0], 'backends')
available_backends = [f for f in os.listdir(backend_dir) if not
f.startswith('_') and not f.startswith('.') and not f.endswith('.py') and not
f.endswith('.pyc')]
available_backends.sort()
- raise ImproperlyConfigured, "Could not load database backend: %s. Is your
DATABASE_ENGINE setting (currently, %r) spelled correctly? Available options
are: %s" % \
- (e, settings.DATABASE_ENGINE, ", ".join(map(repr, available_backends)))
+ if settings.DATABASE_ENGINE not in available_backends:
+ raise ImproperlyConfigured, "%r isn't an available database backend.
vailable options are: %s" % \
+ (settings.DATABASE_ENGINE, ", ".join(map(repr,
available_backends)))
+ 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, '', '', [''])
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---