Skip to content
Browse files

Fixed #7421 -- Improved syncdb implementation not to check for exact …

…exception text, in case of alternate Python implementation. Thanks,

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 5309e18 commit acf888b4bafff0d6f92ef16d9ac4f904c3286e32 @adrianholovaty adrianholovaty committed
Showing with 10 additions and 1 deletion.
  1. +10 −1 django/core/management/commands/
11 django/core/management/commands/
@@ -34,7 +34,16 @@ def handle_noargs(self, **options):
__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:
cursor = connection.cursor()

0 comments on commit acf888b

Please sign in to comment.
Something went wrong with that request. Please try again.