[Zope-Checkins] SVN: Zope/branches/2.9/ Merged 2.10 branch
r77227:77228 into 2.9 branch.
Stefan H. Holek
stefan at epy.co.at
Mon Jul 2 06:42:14 EDT 2007
Log message for revision 77299:
Merged 2.10 branch r77227:77228 into 2.9 branch.
The REQUEST should not accept holds after it has been closed.
Changed:
U Zope/branches/2.9/doc/CHANGES.txt
U Zope/branches/2.9/lib/python/ZPublisher/BaseRequest.py
U Zope/branches/2.9/lib/python/ZPublisher/tests/testBaseRequest.py
-=-
Modified: Zope/branches/2.9/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.9/doc/CHANGES.txt 2007-07-02 10:16:05 UTC (rev 77298)
+++ Zope/branches/2.9/doc/CHANGES.txt 2007-07-02 10:42:14 UTC (rev 77299)
@@ -10,6 +10,8 @@
- Collector #1306: Missing acquisition context on local roles screen.
+ - The REQUEST no longer accepts holds after it has been closed.
+
- Collector #2153: Supporting unquoted cookies with spaces.
- Collector #2295: Comments in PythonScripts could lead to syntax
Modified: Zope/branches/2.9/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/branches/2.9/lib/python/ZPublisher/BaseRequest.py 2007-07-02 10:16:05 UTC (rev 77298)
+++ Zope/branches/2.9/lib/python/ZPublisher/BaseRequest.py 2007-07-02 10:42:14 UTC (rev 77299)
@@ -506,7 +506,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.9/lib/python/ZPublisher/tests/testBaseRequest.py
===================================================================
--- Zope/branches/2.9/lib/python/ZPublisher/tests/testBaseRequest.py 2007-07-02 10:16:05 UTC (rev 77298)
+++ Zope/branches/2.9/lib/python/ZPublisher/tests/testBaseRequest.py 2007-07-02 10:42:14 UTC (rev 77299)
@@ -247,7 +247,18 @@
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)
+
import zope.interface
import zope.component
import zope.testing.cleanup
More information about the Zope-Checkins
mailing list