Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #7597 -- Added code to force the re-opening of the cursor conne…

…ction, 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
  • Loading branch information...
commit bbb384366f6ab86411756ce7b459a2f15d825e08 1 parent 8e0b6bd
@freakboy3742 freakboy3742 authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 django/core/management/commands/syncdb.py
View
7 django/core/management/commands/syncdb.py
@@ -105,7 +105,10 @@ def handle_noargs(self, **options):
# 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 @@ def handle_noargs(self, **options):
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:

0 comments on commit bbb3843

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