summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2008-06-12 04:22:02 +0000
committerAdrian Holovaty <adrian@holovaty.com>2008-06-12 04:22:02 +0000
commitacf888b4bafff0d6f92ef16d9ac4f904c3286e32 (patch)
treef7e037987ff4d875a9f2106e7f6e1a76a00970e1
parent5309e18cbfc85823d1c58e389fd122fff6e17eea (diff)
Fixed #7421 -- Improved syncdb implementation not to check for exact exception text, in case of alternate Python implementation. Thanks, anto.cuni@gmail.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7623 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/core/management/commands/syncdb.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/django/core/management/commands/syncdb.py b/django/core/management/commands/syncdb.py
index b8b2ff1beb..d87644d049 100644
--- a/django/core/management/commands/syncdb.py
+++ b/django/core/management/commands/syncdb.py
@@ -34,7 +34,16 @@ class Command(NoArgsCommand):
try:
__import__(app_name + '.management', {}, {}, [''])
except ImportError, exc:
- if not exc.args[0].startswith('No module named management'):
+ # This is slightly hackish. We want to ignore ImportErrors
+ # if the "management" module itself is missing -- but we don't
+ # want to ignore the exception if the management module exists
+ # but raises an ImportError for some reason. The only way we
+ # can do this is to check the text of the exception. Note that
+ # we're a bit broad in how we check the text, because different
+ # Python implementations may not use the same text. CPython
+ # uses the text "No module named management".
+ msg = exc.args[0]
+ if not msg.startswith('No module named management') or 'management' not in msg:
raise
cursor = connection.cursor()