Try to unwrap functions passed to funplex.
authorFredrik Tolf <fredrik@dolda2000.com>
Tue, 4 Jun 2013 13:21:56 +0000 (15:21 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Tue, 4 Jun 2013 13:21:56 +0000 (15:21 +0200)
wrw/util.py

index e601be39aeef1fc7634cfb29427e9f96ba8f095d..4306e9b97178c03413ff9381726397659a0b6a6f 100644 (file)
@@ -25,8 +25,12 @@ def formparams(callable):
     return wrapper
 
 def funplex(*funs, **nfuns):
+    def unwrap(fun):
+        while hasattr(fun, "__wrapped__"):
+            fun = fun.__wrapped__
+        return fun
     dir = {}
-    dir.update(((fun.__name__, fun) for fun in funs))
+    dir.update(((unwrap(fun).__name__, fun) for fun in funs))
     dir.update(nfuns)
     def handler(req):
         if req.pathinfo == "":