Skip to content

Commit 8ef64cd

Browse files
authored
fix #688: config() can't use with coro app
1 parent 694fe09 commit 8ef64cd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pywebio/platform/page.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,9 @@ def __init__(self):
336336
def __call__(self, func):
337337
self.called = True
338338

339-
@functools.wraps(func)
340-
def wrapper(*args, **kwargs):
341-
return func(*args, **kwargs)
339+
func_copy = functools.partial(func) # to make a copy of the function
340+
# to keep the original function name and docstring
341+
wrapper = functools.wraps(func)(func_copy)
342342

343343
try:
344344
for key, val in configs.items():
@@ -355,4 +355,4 @@ def __del__(self): # if not called as decorator, set the config to global
355355
global _global_config
356356
_global_config = configs
357357

358-
return Decorator()
358+
return Decorator()

0 commit comments

Comments
 (0)