|
2 | 2 | import urllib.parse |
3 | 3 | from collections import namedtuple |
4 | 4 | from collections.abc import Mapping, Sequence |
5 | | -from functools import lru_cache |
6 | | -from functools import partial |
| 5 | +import functools |
7 | 6 | from os import path, environ |
8 | 7 |
|
9 | 8 | from tornado import template |
@@ -57,7 +56,7 @@ def render_page(app, protocol, cdn): |
57 | 56 | css_file=meta.css_file or [], theme=theme, manifest=manifest) |
58 | 57 |
|
59 | 58 |
|
60 | | -@lru_cache(maxsize=64) |
| 59 | +@functools.lru_cache(maxsize=64) |
61 | 60 | def check_theme(theme): |
62 | 61 | """check theme file existence""" |
63 | 62 | if not theme: |
@@ -336,14 +335,18 @@ def __init__(self): |
336 | 335 |
|
337 | 336 | def __call__(self, func): |
338 | 337 | self.called = True |
| 338 | + |
| 339 | + @functools.wraps(func) |
| 340 | + def wrapper(*args, **kwargs): |
| 341 | + return func(*args, **kwargs) |
| 342 | + |
339 | 343 | try: |
340 | | - func = partial(func) # to make a copy of the function |
341 | 344 | for key, val in configs.items(): |
342 | 345 | if val: |
343 | | - setattr(func, '_pywebio_%s' % key, val) |
| 346 | + setattr(wrapper, '_pywebio_%s' % key, val) |
344 | 347 | except Exception: |
345 | 348 | pass |
346 | | - return func |
| 349 | + return wrapper |
347 | 350 |
|
348 | 351 | def __del__(self): # if not called as decorator, set the config to global |
349 | 352 | if self.called: |
|
0 commit comments