Django

Code

Changeset 7623

Show
Ignore:
Timestamp:
06/11/08 23:22:02 (5 months ago)
Author:
adrian
Message:

Fixed #7421 -- Improved syncdb implementation not to check for exact exception text, in case of alternate Python implementation. Thanks, anto.cuni@gmail.com

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/management/commands/syncdb.py

    r7568 r7623  
    3535                __import__(app_name + '.management', {}, {}, ['']) 
    3636            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: 
    3847                    raise 
    3948