Commit d7744844 authored by Stefan H. Holek's avatar Stefan H. Holek

The REQUEST should not accept holds after it has been closed.

parent 7a59e94c
...@@ -8,6 +8,8 @@ Zope Changes ...@@ -8,6 +8,8 @@ Zope Changes
Bugs fixed Bugs fixed
- The REQUEST no longer accepts holds after it has been closed.
- Collector #1441: WebDAV compatibility with Windows Web Folders - Collector #1441: WebDAV compatibility with Windows Web Folders
restored by adding a configuration variable that controls the restored by adding a configuration variable that controls the
sending of the non-standard MS-Author-Via and Public sending of the non-standard MS-Author-Via and Public
......
...@@ -634,7 +634,8 @@ class BaseRequest: ...@@ -634,7 +634,8 @@ class BaseRequest:
def _hold(self, object): def _hold(self, object):
"""Hold a reference to an object to delay it's destruction until mine """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): def exec_callables(callables):
result = None result = None
......
...@@ -247,6 +247,17 @@ class TestBaseRequest(TestCase): ...@@ -247,6 +247,17 @@ class TestBaseRequest(TestCase):
self.assertRaises(NotFound, r.traverse, 'folder/simpleSet') self.assertRaises(NotFound, r.traverse, 'folder/simpleSet')
self.assertRaises(NotFound, r.traverse, 'folder/simpleFrozenSet') 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 from ZPublisher import NotFound
import zope.interface import zope.interface
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment