[Zope-Checkins] CVS: Packages/ZPublisher - Publish.py:1.164.2.5

Chris McDonough chrism at plope.com
Sat Sep 4 22:42:40 EDT 2004


Update of /cvs-repository/Packages/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv23002

Modified Files:
      Tag: Zope-2_7-branch
	Publish.py 
Log Message:
Add Michael Dunstan's "explicit abort after error propagates into publisher" patch as documented in http://zope.org/Collectors/Zope/789 and as required by recent changes to ZODB which prevent a connection from being cleanly closed if modifications are extant in that connection.


=== Packages/ZPublisher/Publish.py 1.164.2.4 => 1.164.2.5 ===
--- Packages/ZPublisher/Publish.py:1.164.2.4	Sun May 23 01:53:44 2004
+++ Packages/ZPublisher/Publish.py	Sat Sep  4 22:42:09 2004
@@ -125,35 +125,30 @@
             if parents:
                 parents=parents[0]
             try:
-                response = err_hook(parents, request,
+                try:
+                    return err_hook(parents, request,
                                     sys.exc_info()[0],
                                     sys.exc_info()[1],
                                     sys.exc_info()[2],
                                     )
-                if transactions_manager:
-                    transactions_manager.abort()
-                return response
-
-            except Retry:
-                if not request.supports_retry():
-                    response = err_hook(parents, request,
+                except Retry:
+                    if not request.supports_retry():
+                        return err_hook(parents, request,
                                         sys.exc_info()[0],
                                         sys.exc_info()[1],
                                         sys.exc_info()[2],
                                         )
-                    if transactions_manager:
-                        transactions_manager.abort()
-                    return response
-
-
+            finally:
                 if transactions_manager:
                     transactions_manager.abort()
-                newrequest=request.retry()
-                request.close()  # Free resources held by the request.
-                try:
-                    return publish(newrequest, module_name, after_list, debug)
-                finally:
-                    newrequest.close()
+
+            # Only reachable if Retry is raised and request supports retry.
+            newrequest=request.retry()
+            request.close()  # Free resources held by the request.
+            try:
+                return publish(newrequest, module_name, after_list, debug)
+            finally:
+                newrequest.close()
 
         else:
             if transactions_manager:



More information about the Zope-Checkins mailing list