diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2008-07-11 14:06:59 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2008-07-11 14:06:59 +0000 |
| commit | bbb384366f6ab86411756ce7b459a2f15d825e08 (patch) | |
| tree | 6dee12f13f0833453e74f3bbbf8186569c0ac109 | |
| parent | 8e0b6bdcd5b8f9f63a5f370970c71164d25946a7 (diff) | |
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.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7889 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/core/management/commands/syncdb.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/django/core/management/commands/syncdb.py b/django/core/management/commands/syncdb.py index 91e78c96e8..8e83ef61eb 100644 --- a/django/core/management/commands/syncdb.py +++ b/django/core/management/commands/syncdb.py @@ -105,7 +105,10 @@ class Command(NoArgsCommand): # Send the post_syncdb signal, so individual apps can do whatever they need # to do at this point. emit_post_sync_signal(created_models, verbosity, interactive) - + + # The connection may have been closed by a syncdb handler. + cursor = connection.cursor() + # Install custom SQL for the app (but only if this # is a model we've just created) for app in models.get_apps(): @@ -144,7 +147,7 @@ class Command(NoArgsCommand): for sql in index_sql: cursor.execute(sql) except Exception, e: - sys.stderr.write("Failed to install index for %s.%s model: %s" % \ + sys.stderr.write("Failed to install index for %s.%s model: %s\n" % \ (app_name, model._meta.object_name, e)) transaction.rollback_unless_managed() else: |
