[Zope-Checkins] SVN: Zope/branches/2.10/ The REQUEST should not
accept holds after it has been closed.
Stefan H. Holek
stefan at epy.co.at
Fri Jun 29 05:49:45 EDT 2007
Log message for revision 77228:
The REQUEST should not accept holds after it has been closed.
Changed:
U Zope/branches/2.10/doc/CHANGES.txt
U Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py
U Zope/branches/2.10/lib/python/ZPublisher/tests/testBaseRequest.py
-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.10/doc/CHANGES.txt 2007-06-29 09:21:26 UTC (rev 77227)
+++ Zope/branches/2.10/doc/CHANGES.txt 2007-06-29 09:49:45 UTC (rev 77228)
@@ -8,6 +8,8 @@
Bugs fixed
+ - The REQUEST no longer accepts holds after it has been closed.
+
- Collector #1441: WebDAV compatibility with Windows Web Folders
restored by adding a configuration variable that controls the
sending of the non-standard MS-Author-Via and Public
Modified: Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py 2007-06-29 09:21:26 UTC (rev 77227)
+++ Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py 2007-06-29 09:49:45 UTC (rev 77228)
@@ -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/branches/2.10/lib/python/ZPublisher/tests/testBaseRequest.py
===================================================================
--- Zope/branches/2.10/lib/python/ZPublisher/tests/testBaseRequest.py 2007-06-29 09:21:26 UTC (rev 77227)
+++ Zope/branches/2.10/lib/python/ZPublisher/tests/testBaseRequest.py 2007-06-29 09:49:45 UTC (rev 77228)
@@ -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 Zope-Checkins
mailing list