[1.1.X] Fixed #13332 -- Corrected the cleanup code in the test client to avoid a refcounting problem with signal handlers. This is a fix for the benefit of PyPy's hybrid GC. Thanks to Alex Gaynor for the report and patch.

Backport of r12964 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2010-04-13 02:43:03 +00:00
parent cf08ea496e
commit 65a9d73069
1 changed files with 43 additions and 39 deletions

View File

@ -216,10 +216,10 @@ class Client(object):
# callback function.
data = {}
on_template_render = curry(store_rendered_templates, data)
signals.template_rendered.connect(on_template_render)
signals.template_rendered.connect(on_template_render, dispatch_uid="template-render")
# Capture exceptions created by the handler.
got_request_exception.connect(self.store_exc_info)
got_request_exception.connect(self.store_exc_info, dispatch_uid="request-exception")
try:
try:
response = self.handler(environ)
@ -263,6 +263,10 @@ class Client(object):
self.cookies.update(response.cookies)
return response
finally:
signals.template_rendered.disconnect(dispatch_uid="template-render")
got_request_exception.disconnect(dispatch_uid="request-exception")
def get(self, path, data={}, follow=False, **extra):
"""