Update controller_aop.py

This commit is contained in:
Eukanj827 2022-08-04 19:16:50 +08:00
parent 1a3fad4d43
commit edf79014bf
1 changed files with 11 additions and 0 deletions

View File

@ -27,6 +27,17 @@ def do_after(rt_result):
def do_exception(exception):
"""Nothing"""
#function name: around
#description: Preserve the function properties and prevent an error from terminating the program
#arguments: One or more functions
#return value: none
#note Decorators are implemented in such a way that the function being decorated is actually another function (the function name and other properties change).
#To avoid this, Python's FuncTools package provides a decorator called wraps to remove such side effects.
#When writing a decorator, it is a good idea to wrap FuncTools before implementing it.
#It preserves the name and properties of the original function
#date: 2022/8/4
#contact: 1865997821
def around(func, *args, **kw):
@wraps(func)
def wrapper():