From d75922dad65b3f0b4ce1fcc0df02d31faffdf437 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 5 Aug 2010 13:18:50 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20#13610=20--=20Improved=20error=20report?= =?UTF-8?q?ing=20when=20the=20ENGINE=20setting=20is=20ommitted=20from=20a?= =?UTF-8?q?=20database=20configuration.=20Thanks=20to=20Gregor=20M=C3=BCll?= =?UTF-8?q?egger=20for=20the=20report=20and=20patch.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://code.djangoproject.com/svn/django/trunk@13489 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- AUTHORS | 1 + django/core/management/__init__.py | 10 +++++----- django/db/__init__.py | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/AUTHORS b/AUTHORS index 96278827c5..b16225741b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -337,6 +337,7 @@ answer newbie questions, and generally made Django that much better: Aljosa Mohorovic Ramiro Morales Eric Moritz + Gregor Müllegger Robin Munn James Murty msundstr diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index 32e744374a..85bf324fdc 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -250,15 +250,15 @@ class ManagementUtility(object): """ try: app_name = get_commands()[subcommand] - if isinstance(app_name, BaseCommand): - # If the command is already loaded, use it directly. - klass = app_name - else: - klass = load_command_class(app_name, subcommand) except KeyError: sys.stderr.write("Unknown command: %r\nType '%s help' for usage.\n" % \ (subcommand, self.prog_name)) sys.exit(1) + if isinstance(app_name, BaseCommand): + # If the command is already loaded, use it directly. + klass = app_name + else: + klass = load_command_class(app_name, subcommand) return klass def autocomplete(self): diff --git a/django/db/__init__.py b/django/db/__init__.py index 4bae04ab9a..4c4faef694 100644 --- a/django/db/__init__.py +++ b/django/db/__init__.py @@ -35,6 +35,8 @@ if DEFAULT_DB_ALIAS not in settings.DATABASES: raise ImproperlyConfigured("You must default a '%s' database" % DEFAULT_DB_ALIAS) for alias, database in settings.DATABASES.items(): + if 'ENGINE' not in database: + raise ImproperlyConfigured("You must specify a 'ENGINE' for database '%s'" % alias) if database['ENGINE'] in ("postgresql", "postgresql_psycopg2", "sqlite3", "mysql", "oracle"): import warnings if 'django.contrib.gis' in settings.INSTALLED_APPS: