装饰器修复:
原创
©著作权归作者所有:来自51CTO博客作者wx63a427ac86e31的原创作品,请联系作者获取转载授权,否则将追究法律责任
from functools import wraps
def wrapper(func):
@wraps(func)
def inner(request,*args,**kwargs):
"""
inner的注释:
:param request:
:param args:
:param kwargs:
:return:
"""
print("before")
ret = func(request,*args,**kwargs)
return ret
return inner
@wrapper
def f1(request):
"""
f1的注释信息
:param request:
:return:
"""
print("f1")
@wrapper
def f2(request):
print("f2")
print(f1.__name__)
print(f1.__doc__)
print(f2.__name__)
f1(1)
f2(2)