[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zope-cvs
Subject:    [Zope-Checkins] SVN:
From:       Tres Seaver <tseaver () palladion ! com>
Date:       2010-05-29 19:20:16
Message-ID: 20100529192016.E72CD941B8 () cvs ! zope ! org
[Download RAW message or body]

Log message for revision 112843:
  Defer closing the request until the transaction commits.
  
  But only if we know that middleware is handling the transaction.

Changed:
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/WSGIPublisher.py

-=-
Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/WSGIPublisher.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/WSGIPublisher.py	2010-05-29 19:20:13 UTC (rev 112842)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/WSGIPublisher.py	2010-05-29 19:20:16 UTC (rev 112843)
@@ -19,6 +19,7 @@
 from zExceptions import Unauthorized
 from ZServer.medusa.http_date import build_http_date
 
+
 from ZPublisher.HTTPResponse import HTTPResponse
 from ZPublisher.HTTPRequest import HTTPRequest
 from ZPublisher.mapply import mapply
@@ -211,7 +212,13 @@
         # XXX This still needs verification that it really works.
         result=(stdout.getvalue(), response.body)
 
-    request.close()
+    if 'repoze.tm.active' in environ:
+        import transaction
+        txn = transaction.get()
+        txn.addAfterCommitHook(lambda ok: request.close())
+    else:
+        request.close() # this aborts the transation!
+
     stdout.close()
 
     if after_list[0] is not None:

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
https://mail.zope.org/mailman/listinfo/zope-checkins
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic