[Checkins] SVN: Zope/trunk/ Merged 2.10 branch r77227:77228 into the trunk.

Stefan H. Holek stefan at epy.co.at
Fri Jun 29 06:12:03 EDT 2007


Log message for revision 77233:
  Merged 2.10 branch r77227:77228 into the trunk.
  
  The REQUEST should not accept holds after it has been closed.
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/ZPublisher/BaseRequest.py
  U   Zope/trunk/lib/python/ZPublisher/tests/testBaseRequest.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2007-06-29 10:11:35 UTC (rev 77232)
+++ Zope/trunk/doc/CHANGES.txt	2007-06-29 10:12:02 UTC (rev 77233)
@@ -102,7 +102,8 @@
 
     Bugs Fixed
 
-<<<<<<< .working
+      - The REQUEST no longer accepts holds after it has been closed.
+
       - Five.browser.metaconfigure.page didn't protect names from interface
         superclasses (http://www.zope.org/Collectors/Zope/2333)
 

Modified: Zope/trunk/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/BaseRequest.py	2007-06-29 10:11:35 UTC (rev 77232)
+++ Zope/trunk/lib/python/ZPublisher/BaseRequest.py	2007-06-29 10:12:02 UTC (rev 77233)
@@ -634,7 +634,8 @@
     def _hold(self, object):
         """Hold a reference to an object to delay it's destruction until mine
         """
-        self._held=self._held+(object,)
+        if self._held is not None:
+            self._held=self._held+(object,)
 
 def exec_callables(callables):
     result = None

Modified: Zope/trunk/lib/python/ZPublisher/tests/testBaseRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/tests/testBaseRequest.py	2007-06-29 10:11:35 UTC (rev 77232)
+++ Zope/trunk/lib/python/ZPublisher/tests/testBaseRequest.py	2007-06-29 10:12:02 UTC (rev 77233)
@@ -247,6 +247,17 @@
         self.assertRaises(NotFound, r.traverse, 'folder/simpleSet')
         self.assertRaises(NotFound, r.traverse, 'folder/simpleFrozenSet')
 
+    def test_hold_after_close(self):
+        # Request should no longer accept holds after it has been closed
+        r = self.makeBaseRequest()
+        r._hold(lambda x: None)
+        self.assertEqual(len(r._held), 1)
+        r.close()
+        # No more holding from now on
+        self.assertEqual(r._held, None)
+        r._hold(lambda x: None)
+        self.assertEqual(r._held, None)
+
 from ZPublisher import NotFound
 
 import zope.interface



More information about the Checkins mailing list