Commits

Andrew Godwin  committed 126a1ad

Fixed #1047: Django 1.3, MySQL and has_ddl_transactions broken. Thanks to carljm for the report.

  • Participants
  • Parent commits 09d357f

Comments (0)

Files changed (1)

File south/db/generic.py

     allows_combined_alters = True
     supports_foreign_keys = True
     has_check_constraints = True
+
     @cached_property
     def has_ddl_transactions(self):
+        "Tests the database using feature detection to see if it has DDL transactional support"
         self._possibly_initialise()
         connection = self._get_connection()
+        # Django 1.3's MySQLdb backend doesn't raise DatabaseError
+        exceptions = (DatabaseError, )
+        try:
+            from MySQLdb import OperationalError
+            exceptions += (OperationalError, )
+        except ImportError:
+            pass
+        # Now do the test
         if connection.features.supports_transactions:
             cursor = connection.cursor()
             self.start_transaction()
             self.rollback_transaction()
             try:
                 cursor.execute('CREATE TABLE DDL_TRANSACTION_TEST (X INT)')
-            except DatabaseError:
+            except exceptions:
                 return False
             else:
                 return True