Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Improved error message if DATABASE_ENGINE is invalid.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2994 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit dc378e8ca7fd099ebf6fda37503db172d445c6d4 1 parent 8e9833f
Adrian Holovaty authored May 26, 2006

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. 7  django/db/__init__.py
7  django/db/__init__.py
@@ -17,8 +17,11 @@
17 17
     backend_dir = os.path.join(__path__[0], 'backends')
18 18
     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')]
19 19
     available_backends.sort()
20  
-    raise ImproperlyConfigured, "Could not load database backend: %s. Is your DATABASE_ENGINE setting (currently, %r) spelled correctly? Available options are: %s" % \
21  
-        (e, settings.DATABASE_ENGINE, ", ".join(map(repr, available_backends)))
  20
+    if settings.DATABASE_ENGINE not in available_backends:
  21
+        raise ImproperlyConfigured, "%r isn't an available database backend. vailable options are: %s" % \
  22
+            (settings.DATABASE_ENGINE, ", ".join(map(repr, available_backends)))
  23
+    else:
  24
+        raise # If there's some other error, this must be an error in Django itself.
22 25
 
23 26
 get_introspection_module = lambda: __import__('django.db.backends.%s.introspection' % settings.DATABASE_ENGINE, '', '', [''])
24 27
 get_creation_module = lambda: __import__('django.db.backends.%s.creation' % settings.DATABASE_ENGINE, '', '', [''])

0 notes on commit dc378e8

Please sign in to comment.
Something went wrong with that request. Please try again.