Commits

Germán M. Bravo committed d542d92

Added transaction savepoints for optional skipping of actions in southwest

Comments (0)

Files changed (1)

south/db/generic.py

         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()