Re: [Zope-Coders] Re: SVN: Zope/trunk/lib/python/Testing/ZopeTestCase/ transaction.commit(1) is deprecated in favor of transaction.savepoint().
Thank you for the clarification, Tim. On 3. Nov 2005, at 16:22, Tim Peters wrote: The full deprecation msg spells it out in more detail: subtransactions are deprecated; instead of transaction.commit (1), use transaction.savepoint(optimistic=True) in contexts where a subtransaction abort will never occur, or sp=transaction.savepoint() if later rollback is possible and then sp.rollback() instead of transaction.abort(1) Last time *I* saw it, it said "subtransactions are deprecated; use transaction.savepoint() instead of transaction.commit(1)" ;-) So, either way, the current code is a bit off target. Best guess is that you're not interested in *sub*transaction aborts here, so that you do want to pass optimistic=True. This is correct. I will pass True then. Stefan -- Anything that happens, happens. --Douglas Adams ___ Zope-Coders mailing list Zope-Coders@zope.org http://mail.zope.org/mailman/listinfo/zope-coders
Re: [Zope-Coders] Re: SVN: Zope/trunk/lib/python/Testing/ZopeTestCase/ transaction.commit(1) is deprecated in favor of transaction.savepoint().
>>> Log message for revision 39807: >>> transaction.commit(1) is deprecated in favor of transaction.savepoint(). [Tres Seaver] >> This likely needs to be 'savepoint(optimistic=True)' (see collector >> #1860 for rationale). [Stefan H. Holek] > Perhaps. However, these tests specifically check interactions between > persistent objects, their attributes, and transaction commit/abort. > If things break there, I want to know about it. The full deprecation msg spells it out in more detail: subtransactions are deprecated; instead of transaction.commit(1), use transaction.savepoint(optimistic=True) in contexts where a subtransaction abort will never occur, or sp=transaction.savepoint() if later rollback is possible and then sp.rollback() instead of transaction.abort(1) If you're not testing *sub*transaction aborts (you only mention "transaction abort" above, and that's not the same thing), then there's no reason to avoid passing optimistic=True. The only effect _not_ passing True has then is to raise a nuisance exception if some data manager involved in the transaction doesn't support the new ISavepoint interface. But if you're never going to do a subtransaction abort, then there's no need for any data manager to support ISavepoint. That's why optimistic= exists. If you _are_ going to do a subtransaction abort, then just calling "transaction.savepoint()" is inadequate: you would need also to assign the result of that to a variable, in order to call its rollback) method later (at the point where you used to do transaction.abort(1)). So, either way, the current code is a bit off target. Best guess is that you're not interested in *sub*transaction aborts here, so that you do want to pass optimistic=True. ___ Zope-Coders mailing list Zope-Coders@zope.org http://mail.zope.org/mailman/listinfo/zope-coders
Re: [Zope-Coders] Re: SVN: Zope/trunk/lib/python/Testing/ZopeTestCase/ transaction.commit(1) is deprecated in favor of transaction.savepoint().
Perhaps. However, these tests specifically check interactions between persistent objects, their attributes, and transaction commit/abort. If things break there, I want to know about it. Stefan On 3. Nov 2005, at 01:10, Tres Seaver wrote: Stefan H. Holek wrote: Log message for revision 39807: transaction.commit(1) is deprecated in favor of transaction.savepoint(). This likely needs to be 'savepoint(optimistic=True)' (see collector #1860 for rationale). -- Anything that happens, happens. --Douglas Adams ___ Zope-Coders mailing list Zope-Coders@zope.org http://mail.zope.org/mailman/listinfo/zope-coders
[Zope-Coders] Re: SVN: Zope/trunk/lib/python/Testing/ZopeTestCase/ transaction.commit(1) is deprecated in favor of transaction.savepoint().
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Stefan H. Holek wrote: > Log message for revision 39807: > transaction.commit(1) is deprecated in favor of transaction.savepoint(). This likely needs to be 'savepoint(optimistic=True)' (see collector #1860 for rationale). Tres. - -- === Tres Seaver +1 202-558-7113 [EMAIL PROTECTED] Palladion Software "Excellence by Design"http://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDaVWC+gerLs4ltQ4RAgXvAKDOXY4mj+i3OQPBiIvFIITqcaF1EwCfW0vx FffUmrPQGyXvugGQia+SsJ4= =ZtKT -END PGP SIGNATURE- ___ Zope-Coders mailing list Zope-Coders@zope.org http://mail.zope.org/mailman/listinfo/zope-coders
[Zope-Coders] Re: SVN: Zope/trunk/lib/python/Testing/ZopeTestCase/ transaction.commit(1) is deprecated in favor of transaction.savepoint().
Stefan H. Holek wrote: Log message for revision 39807: transaction.commit(1) is deprecated in favor of transaction.savepoint(). Actually, in favor of transaction.savepoint(optimistic=True). Florent Changed: U Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt U Zope/trunk/lib/python/Testing/ZopeTestCase/testZODBCompat.py -=- Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt === --- Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2005-11-01 12:55:46 UTC (rev 39806) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2005-11-01 13:00:43 UTC (rev 39807) @@ -1,4 +1,5 @@ Unreleased +- transaction.commit(1) is deprecated in favor of transaction.savepoint(). - Don't break if Python distros ship without profile support (Debian, Ubuntu). - Functional.publish() would hang if it got a request_method argument other than GET or HEAD while omitting the stdin argument. Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testZODBCompat.py === --- Zope/trunk/lib/python/Testing/ZopeTestCase/testZODBCompat.py 2005-11-01 12:55:46 UTC (rev 39806) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/testZODBCompat.py 2005-11-01 13:00:43 UTC (rev 39807) @@ -42,7 +42,7 @@ self.folder.addDTMLMethod('doc', file='foo') # _p_oids are None until we commit a subtransaction self.assertEqual(self.folder._p_oid, None) -transaction.commit(1) +transaction.savepoint() self.failIfEqual(self.folder._p_oid, None) def testCutPaste(self): @@ -93,7 +93,7 @@ self.folder.addDTMLMethod('doc', file='foo') # _p_oids are None until we commit a subtransaction self.assertEqual(self.folder._p_oid, None) -transaction.commit(1) +transaction.savepoint() self.failIfEqual(self.folder._p_oid, None) def testExport(self): @@ -315,7 +315,7 @@ def testSubTransactionAbort(self): self.folder.foo = 1 self.failUnless(hasattr(self.folder, 'foo')) -transaction.commit(1) +transaction.savepoint() transaction.abort() # This time the abort nukes the foo attribute... self.failIf(hasattr(self.folder, 'foo')) @@ -330,7 +330,7 @@ def testSubTransactionAbortPersistent(self): self.folder._p_foo = 1 self.failUnless(hasattr(self.folder, '_p_foo')) -transaction.commit(1) +transaction.savepoint() transaction.abort() # This time the abort nukes the _p_foo attribute... self.failIf(hasattr(self.folder, '_p_foo')) @@ -345,7 +345,7 @@ def testSubTransactionAbortVolatile(self): self.folder._v_foo = 1 self.failUnless(hasattr(self.folder, '_v_foo')) -transaction.commit(1) +transaction.savepoint() transaction.abort() # This time the abort nukes the _v_foo attribute... self.failIf(hasattr(self.folder, '_v_foo')) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins -- Florent Guillaume, Nuxeo (Paris, France) Director of R&D +33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED] ___ Zope-Coders mailing list Zope-Coders@zope.org http://mail.zope.org/mailman/listinfo/zope-coders