Django

Code

Changeset 7889

Show
Ignore:
Timestamp:
07/11/08 09:06:59 (4 months ago)
Author:
russellm
Message:

Fixed #7597 -- Added code to force the re-opening of the cursor connection, just in case a post-syncdb handler closes it. Thanks to keithb for the report and fix.

Files:

Legend:

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

    r7704 r7889  
    106106        # to do at this point. 
    107107        emit_post_sync_signal(created_models, verbosity, interactive) 
    108  
     108         
     109        # The connection may have been closed by a syncdb handler. 
     110        cursor = connection.cursor() 
     111         
    109112        # Install custom SQL for the app (but only if this 
    110113        # is a model we've just created) 
     
    145148                                cursor.execute(sql) 
    146149                        except Exception, e: 
    147                             sys.stderr.write("Failed to install index for %s.%s model: %s" % \ 
     150                            sys.stderr.write("Failed to install index for %s.%s model: %s\n" % \ 
    148151                                                (app_name, model._meta.object_name, e)) 
    149152                            transaction.rollback_unless_managed()