1. Germán M. Bravo
  2. south

Commits

Germán M. Bravo  committed d542d92

Added transaction savepoints for optional skipping of actions in southwest

  • Participants
  • Parent commits a804ba9
  • Branches default

Comments (0)

Files changed (1)

File south/db/generic.py

View file
         get_logger().debug('execute "%s" with params "%s"' % (sql, params))
 
         try:
+            sid = transaction.savepoint()
             cursor.execute(sql, params)
         except DatabaseError, e:
-            print >> sys.stderr, 'FATAL ERROR - The following SQL query failed: %s' % sql
-            print >> sys.stderr, 'The error was: %s' % e
-            raise
+            transaction.savepoint_rollback(sid)
+            # e = "The following SQL query failed: %s\nThe error was: %s" % (sql, e)
+            raise ValueError(e)
+        finally:
+            transaction.savepoint_commit(sid)
 
         try:
             return cursor.fetchall()