Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用config装饰器装饰的应用函数丢失了原本的__name__ #653

Open
jackwolfey opened this issue Jul 18, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@jackwolfey
Copy link

BUG描述
使用config装饰器装饰的应用函数丢失了原本的__name__
这会导致当在一个app函数上套了多个装饰器再搭配使用start_server()部署多个应用时,引发ValueError: Duplicated application name报错

环境信息

  • 操作系统及版本: Windows 11 21H2
  • 浏览器及版本: Microsoft Edge 126.0.2592.102
  • Python版本: Python 3.10.13
  • PyWebIO版本: 1.8.3

最小可复现示例

from pywebio import output
from pywebio.platform import start_server, config
from pywebio.session import run_js
from functools import wraps


def remove_footer(webio_app):
    @wraps(webio_app)
    def remove_footer_wrapper():
        jscode = """$(".footer").remove();"""
        run_js(jscode)
        webio_app()

    return remove_footer_wrapper


@remove_footer
@config(title='show text')
def show_text():
    output.put_text('abc')


@remove_footer
@config(title='show markdown')
def show_markdown():
    output.put_markdown('# abc')


if __name__ == '__main__':
    start_server([show_text, show_markdown])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant