Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Russell Keith-Magee authored July 11, 2008

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. 7  django/core/management/commands/syncdb.py
7  django/core/management/commands/syncdb.py
@@ -105,7 +105,10 @@ def handle_noargs(self, **options):
105 105
         # Send the post_syncdb signal, so individual apps can do whatever they need
106 106
         # to do at this point.
107 107
         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
+        
109 112
         # Install custom SQL for the app (but only if this
110 113
         # is a model we've just created)
111 114
         for app in models.get_apps():
@@ -144,7 +147,7 @@ def handle_noargs(self, **options):
144 147
                             for sql in index_sql:
145 148
                                 cursor.execute(sql)
146 149
                         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" % \
148 151
                                                 (app_name, model._meta.object_name, e))
149 152
                             transaction.rollback_unless_managed()
150 153
                         else:

0 notes on commit bbb3843

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