From 0f18b7748229b3b899cbc9b7b320d10cd5a668ed Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Tue, 4 Jun 2013 15:18:52 +0200 Subject: [PATCH] Save references to wrapped functions. --- wrw/dispatch.py | 1 + wrw/util.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/wrw/dispatch.py b/wrw/dispatch.py index 4d22b72..1dedbe6 100644 --- a/wrw/dispatch.py +++ b/wrw/dispatch.py @@ -24,6 +24,7 @@ def defaulterror(req, excinfo): def wraphandler(handler, excinfo): def wrapped(req): return handler(req, excinfo) + wrapped.__wrapped__ = handler return wrapped errorhandler = env.var(defaulterror) diff --git a/wrw/util.py b/wrw/util.py index abf865e..e601be3 100644 --- a/wrw/util.py +++ b/wrw/util.py @@ -4,6 +4,7 @@ import req, dispatch, session, form, resp, proto def wsgiwrap(callable): def wrapper(env, startreq): return dispatch.handleenv(env, startreq, callable) + wrapper.__wrapped__ = callable return wrapper def formparams(callable): @@ -20,6 +21,7 @@ def formparams(callable): if spec.args[i] not in args: raise resp.httperror(400, "Missing parameter", ("The query parameter `", resp.h.code(spec.args[i]), "' is required but not supplied.")) return callable(**args) + wrapper.__wrapped__ = callable return wrapper def funplex(*funs, **nfuns): @@ -55,6 +57,7 @@ def persession(data = None): sess[data] = data() sess[callable] = callable(data) return sess[callable].handle(req) + wrapper.__wrapped__ = callable return wrapper return dec @@ -87,6 +90,7 @@ class preiter(object): def pregen(callable): def wrapper(*args, **kwargs): return preiter(callable(*args, **kwargs)) + wrapper.__wrapped__ = callable return wrapper class sessiondata(object): -- 2.11.0