Django

Code

Changeset 2994

Show
Ignore:
Timestamp:
05/26/06 14:02:23 (2 years ago)
Author:
adrian
Message:

Improved error message if DATABASE_ENGINE is invalid.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/db/__init__.py

    r2809 r2994  
    1818    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')] 
    1919    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. 
    2225 
    2326get_introspection_module = lambda: __import__('django.db.backends.%s.introspection' % settings.DATABASE_ENGINE, '', '', [''])