From 391165d8122abeecbb571d0fbc1e1cec381ae8ce Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Wed, 18 Jan 2012 20:04:00 +0100 Subject: [PATCH] Avoid using a weakref.proxy for CallContext.request because we need to get a real ref to the request at some point in the tests --- wsme/protocols/__init__.py | 6 +++++- wsme/tests/test_protocols.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wsme/protocols/__init__.py b/wsme/protocols/__init__.py index ed9d813..137d142 100644 --- a/wsme/protocols/__init__.py +++ b/wsme/protocols/__init__.py @@ -13,12 +13,16 @@ registered_protocols = {} class CallContext(object): def __init__(self, request): - self.request = weakref.proxy(request) + self._request = weakref.ref(request) self.path = None self.func = None self.funcdef = None + @property + def request(self): + return self._request() + def register_protocol(protocol): registered_protocols[protocol.name] = protocol diff --git a/wsme/tests/test_protocols.py b/wsme/tests/test_protocols.py index ae6e906..f073497 100644 --- a/wsme/tests/test_protocols.py +++ b/wsme/tests/test_protocols.py @@ -24,7 +24,7 @@ class DummyProtocol(object): return ['touch'] def read_arguments(self, context): - self.lastreq = context.request.__init__.__self__ + self.lastreq = context.request self.hits += 1 return {}