Fixed #5552 -- Raise an error, rather than failing silently, when DATABASE_NAME

is not specified for SQLite.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7956 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-07-18 22:36:31 +00:00
parent 13643a7f5d
commit 436ef181f3
1 changed files with 3 additions and 0 deletions

View File

@ -110,6 +110,9 @@ class DatabaseWrapper(BaseDatabaseWrapper):
def _cursor(self, settings): def _cursor(self, settings):
if self.connection is None: if self.connection is None:
if not settings.DATABASE_NAME:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured, "Please fill out DATABASE_NAME in the settings module before using the database."
kwargs = { kwargs = {
'database': settings.DATABASE_NAME, 'database': settings.DATABASE_NAME,
'detect_types': Database.PARSE_DECLTYPES | Database.PARSE_COLNAMES, 'detect_types': Database.PARSE_DECLTYPES | Database.PARSE_COLNAMES,