Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.0.X] Corrected code in serializers_regress testcase so that, in th…

…e case where an exception has been raised, rollback is called before attempting to leave transaction management. With the old code the original exception (IntegrityError on InnoDB) was getting hidden by a transaction management error resulting from attempting to leave transaction management with a pending commit/rollback.

r9773 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9774 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5ce4031a6156112158011604bb41141b09a3546e 1 parent 02980f1
Karen Tracey authored January 18, 2009
10  tests/regressiontests/serializers_regress/tests.py
@@ -360,8 +360,11 @@ def serializerTest(format, self):
360 360
             objects.extend(func[0](pk, klass, datum))
361 361
             instance_count[klass] = 0
362 362
         transaction.commit()
363  
-    finally:
  363
+    except:
  364
+        transaction.rollback()
364 365
         transaction.leave_transaction_management()
  366
+        raise
  367
+    transaction.leave_transaction_management()
365 368
 
366 369
     # Get a count of the number of objects created for each class
367 370
     for klass in instance_count:
@@ -381,8 +384,11 @@ def serializerTest(format, self):
381 384
         for obj in serializers.deserialize(format, serialized_data):
382 385
             obj.save()
383 386
         transaction.commit()
384  
-    finally:
  387
+    except:
  388
+        transaction.rollback()
385 389
         transaction.leave_transaction_management()
  390
+        raise
  391
+    transaction.leave_transaction_management()
386 392
 
387 393
     # Assert that the deserialized data is the same
388 394
     # as the original source

0 notes on commit 5ce4031

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