-def funplex(*funs, **nfuns):
- dir = {}
- dir.update(((fun.__name__, fun) for fun in funs))
- dir.update(nfuns)
- def handler(req):
+class funplex(object):
+ def __init__(self, *funs, **nfuns):
+ self.dir = {}
+ self.dir.update(((self.unwrap(fun).__name__, fun) for fun in funs))
+ self.dir.update(nfuns)
+
+ @staticmethod
+ def unwrap(fun):
+ while hasattr(fun, "__wrapped__"):
+ fun = fun.__wrapped__
+ return fun
+
+ def __call__(self, req):