def _curate_handler(self, handler):
if isinstance(handler, str):
handler = getattr(self, handler)
function_type = (types.FunctionType, types.BuiltinFunctionType)
if isinstance(handler, function_type):
return handler
method_type = (types.MethodType, types.BuiltinMethodType)
if isinstance(handler, method_type):
return unbound_method(handler)
raise TypeError('Unknown handler type "%s"' % type(handler))
评论列表
文章目录