[zope2-tracker] [Bug 787541] Re: WSGIPublisher leaves the request open on error

stephan_hofmockel 787541 at bugs.launchpad.net
Sun Oct 16 09:51:16 EST 2011


Hello,
the current implementation of this bugfix breaks the following code. 
Assuming a request which sends 'a' and 'b' as parameters, eg. URL?a=test&b=test

import transaction

def do_something(self, request):
    self.attribute_a = request.get('a')
    transaction.commit()
    ...... possible other code which raises an Exception .....
   # the b parameter has to occur !
   assert request.get('b') == None
    
I use this in situations where I would like to be sure that 'self.attrbiute_a' is inside the ZODB regardless if an error happens afterwards or not. However after transaction.commit() the request is closed, because transaction.commit() calls 'afterCompletion' of '_RequestCloserForTransaction'. This means all parameters send in a form are lost/cleared and not available anymore.

Would it make sens to change the Bugfix in ZPublisher a little bit so that
247         _request_closer_for_repoze_tm.add(txn, request)
 is called after
252         response = _publish(request, 'Zope2')

If its a bug in ZOPE, I can work on a patch + test. 
If I'm misusing transaction.commit(), plz tell me how it is done right.

-- 
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.
https://bugs.launchpad.net/bugs/787541

Title:
  WSGIPublisher leaves the request open on error

To manage notifications about this bug go to:
https://bugs.launchpad.net/zope2/+bug/787541/+subscriptions


More information about the zope2-tracker mailing list