Don't copy attributes that don't exist to partial instances
Classes don't have an `__name__` attribute, so when wrapping them in a `functools.partial` instance, don't try to copy it. Same goes for `__doc__`, but most objects should have that.master
parent
6cf47a0339
commit
ab4ca55620
|
@ -50,7 +50,9 @@ class Router(object):
|
|||
urlvars = match.groupdict()
|
||||
urlvars.update(vars)
|
||||
func = functools.partial(controller, **urlvars)
|
||||
if hasattr(func, '__name__'):
|
||||
func.__name__ = controller.__name__
|
||||
if hasattr(func, '__doc__'):
|
||||
func.__doc__ = controller.__doc__
|
||||
self._cache[path_info] = func
|
||||
return func
|
||||
|
|
Loading…
Reference in New Issue