_cpconfig.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:autosub-bootstrapbill 作者: BenjV 项目源码 文件源码
def _engine_namespace_handler(k, v):
    """Config handler for the "engine" namespace."""
    engine = cherrypy.engine

    if k == 'SIGHUP':
        engine.subscribe('SIGHUP', v)
    elif k == 'SIGTERM':
        engine.subscribe('SIGTERM', v)
    elif '.' in k:
        plugin, attrname = k.split('.', 1)
        plugin = getattr(engine, plugin)
        if attrname == 'on':
            if v and hasattr(getattr(plugin, 'subscribe', None), '__call__'):
                plugin.subscribe()
                return
            elif (
                (not v) and
                hasattr(getattr(plugin, 'unsubscribe', None), '__call__')
            ):
                plugin.unsubscribe()
                return
        setattr(plugin, attrname, v)
    else:
        setattr(engine, k, v)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号