Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit acf888b4bafff0d6f92ef16d9ac4f904c3286e32 1 parent 5309e18
Adrian Holovaty authored June 12, 2008
11  django/core/management/commands/syncdb.py
@@ -34,7 +34,16 @@ def handle_noargs(self, **options):
34 34
             try:
35 35
                 __import__(app_name + '.management', {}, {}, [''])
36 36
             except ImportError, exc:
37  
-                if not exc.args[0].startswith('No module named management'):
  37
+                # This is slightly hackish. We want to ignore ImportErrors
  38
+                # if the "management" module itself is missing -- but we don't
  39
+                # want to ignore the exception if the management module exists
  40
+                # but raises an ImportError for some reason. The only way we
  41
+                # can do this is to check the text of the exception. Note that
  42
+                # we're a bit broad in how we check the text, because different
  43
+                # Python implementations may not use the same text. CPython
  44
+                # uses the text "No module named management".
  45
+                msg = exc.args[0]
  46
+                if not msg.startswith('No module named management') or 'management' not in msg:
38 47
                     raise
39 48
 
40 49
         cursor = connection.cursor()

0 notes on commit acf888b

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