forked from huawei/openGauss-server
Update controller_aop.py
This commit is contained in:
parent
1a3fad4d43
commit
edf79014bf
|
|
@ -27,6 +27,17 @@ def do_after(rt_result):
|
||||||
def do_exception(exception):
|
def do_exception(exception):
|
||||||
"""Nothing"""
|
"""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):
|
def around(func, *args, **kw):
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def wrapper():
|
def wrapper():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue