Try to unwrap functions passed to funplex.
[wrw.git] / wrw / util.py
index e601be3..4306e9b 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 == "":