Skip to content

Commit c348d0a

Browse files
committed
fix #653
1 parent 185333a commit c348d0a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pywebio/platform/page.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
import urllib.parse
33
from collections import namedtuple
44
from collections.abc import Mapping, Sequence
5-
from functools import lru_cache
6-
from functools import partial
5+
import functools
76
from os import path, environ
87

98
from tornado import template
@@ -57,7 +56,7 @@ def render_page(app, protocol, cdn):
5756
css_file=meta.css_file or [], theme=theme, manifest=manifest)
5857

5958

60-
@lru_cache(maxsize=64)
59+
@functools.lru_cache(maxsize=64)
6160
def check_theme(theme):
6261
"""check theme file existence"""
6362
if not theme:
@@ -336,14 +335,18 @@ def __init__(self):
336335

337336
def __call__(self, func):
338337
self.called = True
338+
339+
@functools.wraps(func)
340+
def wrapper(*args, **kwargs):
341+
return func(*args, **kwargs)
342+
339343
try:
340-
func = partial(func) # to make a copy of the function
341344
for key, val in configs.items():
342345
if val:
343-
setattr(func, '_pywebio_%s' % key, val)
346+
setattr(wrapper, '_pywebio_%s' % key, val)
344347
except Exception:
345348
pass
346-
return func
349+
return wrapper
347350

348351
def __del__(self): # if not called as decorator, set the config to global
349352
if self.called:

0 commit comments

Comments
 (0)