Hi Matthew, I think you merged a little bit too much here. You picked the previous revision of startup.py by accident.
On Wed, Nov 5, 2008 at 11:08 AM, Matthew Wilkes <[EMAIL PROTECTED]> wrote: > Log message for revision 92793: > Backported DoomedTransaction handling from trunk r92792 to 2.11 branch > > Changed: > U Zope/branches/2.11/lib/python/Zope2/App/startup.py > A Zope/branches/2.11/lib/python/Zope2/App/tests/testDoomedTransaction.py > > -=- > Modified: Zope/branches/2.11/lib/python/Zope2/App/startup.py > =================================================================== > --- Zope/branches/2.11/lib/python/Zope2/App/startup.py 2008-11-05 12:41:21 > UTC (rev 92792) > +++ Zope/branches/2.11/lib/python/Zope2/App/startup.py 2008-11-05 13:08:33 > UTC (rev 92793) > @@ -249,7 +249,15 @@ > REQUEST['AUTHENTICATED_USER'] = AccessControl.User.nobody > > try: > - f(client, REQUEST, t, v, traceback, > error_log_url=error_log_url) > + result = f(client, REQUEST, t, v, > + traceback, > + error_log_url=error_log_url) > + if result is not None: > + t, v, traceback = result > + response = REQUEST.RESPONSE > + response.setStatus(t) > + response.setBody(v) > + return response > except TypeError: > # Pre 2.6 call signature > f(client, REQUEST, t, v, traceback) > @@ -267,7 +275,10 @@ > transaction.begin() > > def commit(self): > - transaction.commit() > + if hasattr(transaction, 'isDoomed') and transaction.isDoomed(): > + transaction.abort() > + else: > + transaction.commit() > > def abort(self): > transaction.abort() > > Copied: > Zope/branches/2.11/lib/python/Zope2/App/tests/testDoomedTransaction.py (from > rev 92792, Zope/trunk/lib/python/Zope2/App/tests/testDoomedTransaction.py) > =================================================================== > --- Zope/branches/2.11/lib/python/Zope2/App/tests/testDoomedTransaction.py > (rev 0) > +++ Zope/branches/2.11/lib/python/Zope2/App/tests/testDoomedTransaction.py > 2008-11-05 13:08:33 UTC (rev 92793) > @@ -0,0 +1,43 @@ > +############################################################################## > +# > +# Copyright (c) 2007 Zope Corporation and Contributors. > +# All Rights Reserved. > +# > +# This software is subject to the provisions of the Zope Public License, > +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. > +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED > +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED > +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS > +# FOR A PARTICULAR PURPOSE. > +# > +############################################################################## > + > +import sys > +import unittest > +import logging > +import transaction > + > +class DoomedTransactionInManagerTest(unittest.TestCase): > + > + def testDoomedFails(self): > + transaction.begin() > + trans = transaction.get() > + trans.doom() > + from transaction.interfaces import DoomedTransaction > + self.assertRaises(DoomedTransaction, trans.commit) > + > + def testDoomedSilentInTM(self): > + from Zope2.App.startup import TransactionsManager > + tm = TransactionsManager() > + transaction.begin() > + trans = transaction.get() > + trans.doom() > + tm.commit() > + > +def test_suite(): > + suite = unittest.TestSuite() > + suite.addTest(unittest.makeSuite(DoomedTransactionInManagerTest)) > + return suite > + > +if __name__ == '__main__': > + unittest.main(defaultTest='test_suite') > > _______________________________________________ > Checkins mailing list > [EMAIL PROTECTED] > http://mail.zope.org/mailman/listinfo/checkins > -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 Skype zopedc _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins