[Zope-Checkins] SVN: Zope/branches/2.11/ Backport r104360 from trunk: do not emit the request closed event from a request clone
Martijn Pieters
mj at zopatista.com
Fri Sep 18 16:55:40 EDT 2009
Log message for revision 104363:
Backport r104360 from trunk: do not emit the request closed event from a request clone
Changed:
U Zope/branches/2.11/doc/CHANGES.txt
U Zope/branches/2.11/lib/python/ZPublisher/BaseRequest.py
U Zope/branches/2.11/lib/python/ZPublisher/HTTPRequest.py
U Zope/branches/2.11/lib/python/ZPublisher/tests/testHTTPRequest.py
-=-
Modified: Zope/branches/2.11/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.11/doc/CHANGES.txt 2009-09-18 20:32:27 UTC (rev 104362)
+++ Zope/branches/2.11/doc/CHANGES.txt 2009-09-18 20:55:40 UTC (rev 104363)
@@ -4,6 +4,13 @@
Change information for previous versions of Zope can be found in the
file HISTORY.txt.
+ Zope 2.11.5 (Unreleased)
+
+ Bugs Fixed
+
+ - LP #414757 (backported from Zope trunk): don't emit a IEndRequestEvent
+ when clearing a cloned request.
+
Zope 2.11.4 (2009/08/06)
Restructuring
Modified: Zope/branches/2.11/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/branches/2.11/lib/python/ZPublisher/BaseRequest.py 2009-09-18 20:32:27 UTC (rev 104362)
+++ Zope/branches/2.11/lib/python/ZPublisher/BaseRequest.py 2009-09-18 20:55:40 UTC (rev 104363)
@@ -203,11 +203,14 @@
else: other.update(kw)
self.other=other
- def close(self):
+ def clear(self):
self.other.clear()
- notify(EndRequestEvent(None, self))
self._held=None
+ def close(self):
+ self.clear()
+ notify(EndRequestEvent(None, self))
+
def processInputs(self):
"""Do any input processing that could raise errors
"""
Modified: Zope/branches/2.11/lib/python/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/branches/2.11/lib/python/ZPublisher/HTTPRequest.py 2009-09-18 20:32:27 UTC (rev 104362)
+++ Zope/branches/2.11/lib/python/ZPublisher/HTTPRequest.py 2009-09-18 20:55:40 UTC (rev 104363)
@@ -149,7 +149,7 @@
r.retry_count=self.retry_count
return r
- def close(self):
+ def clear(self):
# Clear all references to the input stream, possibly
# removing tempfiles.
self.stdin = None
@@ -159,7 +159,7 @@
# one. Without this, there's the possibility of memory leaking
# after every request.
self._lazies = {}
- BaseRequest.close(self)
+ BaseRequest.clear(self)
def setServerURL(self, protocol=None, hostname=None, port=None):
""" Set the parts of generated URLs. """
@@ -1082,7 +1082,7 @@
try: object=req.traverse(path)
except: rsp.exception()
if object is None:
- req.close()
+ req.clear()
raise rsp.errmsg, sys.exc_info()[1]
# The traversal machinery may return a "default object"
@@ -1100,7 +1100,7 @@
if name != os.path.split(path)[-1]:
object=req.PARENTS[0]
- req.close()
+ req.clear()
return object
Modified: Zope/branches/2.11/lib/python/ZPublisher/tests/testHTTPRequest.py
===================================================================
--- Zope/branches/2.11/lib/python/ZPublisher/tests/testHTTPRequest.py 2009-09-18 20:32:27 UTC (rev 104362)
+++ Zope/branches/2.11/lib/python/ZPublisher/tests/testHTTPRequest.py 2009-09-18 20:55:40 UTC (rev 104363)
@@ -75,6 +75,20 @@
self.assertEqual( user_id_x, user_id )
self.assertEqual( password_x, password )
+ def test_resolve_url_doesnt_send_endrequestevent(self):
+ import zope.event
+ events = []
+ zope.event.subscribers.append(events.append)
+ request = self._makeOne()
+ request['PARENTS'] = [object()]
+ try:
+ request.resolve_url(request.script + '/')
+ finally:
+ zope.event.subscribers.remove(events.append)
+ self.failIf(len(events),
+ "HTTPRequest.resolve_url should not emit events")
+
+
class RecordTests( unittest.TestCase ):
def test_repr( self ):
More information about the Zope-Checkins
mailing list