[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/publication/zopepublication.py Updated the cleanup object to be an IHeld so it can call the

Jim Fulton jim at zope.com
Mon Apr 25 16:18:44 EDT 2005


Log message for revision 30174:
  Updated the cleanup object to be an IHeld so it can call the
  connection close method to it immediately when a request is closed.
  This makes it easier to debug cases where the connection close method
  fails, which is usually when it is closed while there are pending
  changes.
  

Changed:
  U   Zope3/trunk/src/zope/app/publication/zopepublication.py

-=-
Modified: Zope3/trunk/src/zope/app/publication/zopepublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/zopepublication.py	2005-04-25 20:18:36 UTC (rev 30173)
+++ Zope3/trunk/src/zope/app/publication/zopepublication.py	2005-04-25 20:18:43 UTC (rev 30174)
@@ -29,7 +29,7 @@
 from zope.component.exceptions import ComponentLookupError
 from zope.interface import implements, providedBy
 from zope.publisher.publish import mapply
-from zope.publisher.interfaces import Retry, IExceptionSideEffects
+from zope.publisher.interfaces import Retry, IExceptionSideEffects, IHeld
 from zope.publisher.interfaces import IRequest, IPublication
 from zope.security.management import newInteraction, endInteraction
 from zope.security.checker import ProxyFactory
@@ -54,12 +54,21 @@
 
 class Cleanup(object):
 
+    implements(IHeld)
+
     def __init__(self, f):
         self._f = f
 
-    def __del__(self):
+    def release(self):
         self._f()
+        self._f = None
 
+    def __del__(self):
+        if self._f is not None:
+            logging.getLogger('SiteError').error(
+                "Cleanup without request close")
+            self._f()
+
 class ZopePublication(PublicationTraverse):
     """Base Zope publication specification."""
     implements(IPublication)



More information about the Zope3-Checkins mailing list