Django

Code

Changeset 122

Show
Ignore:
Timestamp:
07/16/05 17:21:50 (3 years ago)
Author:
adrian
Message:

Added helpful error message if DATABASE_NAME or DATABASE_USER is blank for postgresql

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/db/backends/postgresql.py

    r110 r122  
    1818        from django.conf.settings import DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_PASSWORD, DEBUG, TIME_ZONE 
    1919        if self.connection is None: 
    20             # Note that "host=" has to be last, because it might be blank. 
     20            if DATABASE_NAME == '' or DATABASE_USER == '': 
     21                from django.core.exceptions import ImproperlyConfigured 
     22                raise ImproperlyConfigured, "You need to specify both DATABASE_NAME and DATABASE_USER in your Django settings file." 
    2123            conn_string = "user=%s dbname=%s" % (DATABASE_USER, DATABASE_NAME) 
    2224            if DATABASE_PASSWORD: