当前位置: 首页>>代码示例>>Python>>正文


Python bottle.PluginError方法代码示例

本文整理汇总了Python中bottle.PluginError方法的典型用法代码示例。如果您正苦于以下问题:Python bottle.PluginError方法的具体用法?Python bottle.PluginError怎么用?Python bottle.PluginError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bottle的用法示例。


在下文中一共展示了bottle.PluginError方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import PluginError [as 别名]
def setup(self, app):
        """ Make sure that other installed plugins don't affect the same
            keyword argument and check if metadata is available."""
        for other in app.plugins:
            if not isinstance(other, AuthPlugin):
                continue
            if other.keyword == self.keyword:
                raise bottle.PluginError("Found another auth plugin "
                                         "with conflicting settings ("
                                         "non-unique keyword).") 
开发者ID:avelino,项目名称:bottle-auth,代码行数:12,代码来源:__init__.py

示例2: setup

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import PluginError [as 别名]
def setup(self, app):
        ''' Make sure that other installed plugins don't affect the same
            keyword argument.'''
        for other in app.plugins:
            if not isinstance(other, self.__class__):
                continue
            if other.keyword == self.keyword:
                raise PluginError("Found another AuthorizationHeaderBottlePlugin plugin with "
                                  "conflicting settings (non-unique keyword).") 
开发者ID:biicode,项目名称:bii-server,代码行数:11,代码来源:authorization_header.py

示例3: setup

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import PluginError [as 别名]
def setup(self, app):
        ''' Make sure that other installed plugins don't affect the same
            keyword argument.'''
        for other in app.plugins:
            if hasattr(other, "keyword"):
                if other.keyword == self.keyword:
                    raise PluginError("Found another BSONBottlePlugin plugin with "\
                    "conflicting settings (non-unique keyword).") 
开发者ID:biicode,项目名称:bii-server,代码行数:10,代码来源:bson_bottle_plugin.py

示例4: testAddOtherPluginWithSameKeywork

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import PluginError [as 别名]
def testAddOtherPluginWithSameKeywork(self):
        app = Mock()
        bad_plugin = Mock()
        bad_plugin.keyword = "bson_data"
        app.plugins = set([bad_plugin])
        self.assertRaises(PluginError, self.plugin.setup, app) 
开发者ID:biicode,项目名称:bii-server,代码行数:8,代码来源:bson_bottle_test.py

示例5: __init__

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import PluginError [as 别名]
def __init__(self, domain, locale_dir, lang_code=None, default='en', keyword='i18n'):
        self.domain = domain
        if locale_dir is None:
            raise PluginError('No locale directory found, please assign a right one.')
        self._locale_dir = locale_dir
        
        self._locales = self._get_languages(self._locale_dir)
        self._default = default
        self._lang_code = lang_code
        
        self._cache = {}
        self._apps = []
        self._keyword = keyword 
开发者ID:mgard,项目名称:epater,代码行数:15,代码来源:bottle_i18n.py

示例6: setup

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import PluginError [as 别名]
def setup(self, app):  # pragma: no cover
        """Make sure that other installed plugins don't affect the same
        keyword argument and check if metadata is available.
        """

        if self.login_enable:

            #  Route a login handler in bottle.py app instance.
            @app.post(self.auth_endpoint)
            def auth_handler():
                try:
                    token, expires = self.provider.authenticate(bottle.request)
                    return {"token": token.decode("utf-8"), "expires": str(expires)}

                except JWTAuthError as error:
                    return {"AuthError": error.args[0]}

                except JWTBackendError:
                    return {"AuthBackendError": "Try later or contact admin!"}

        for other in app.plugins:
            if not isinstance(other, JWTProviderPlugin):
                continue

            if other.keyword == self.keyword:
                raise bottle.PluginError("Found another JWT plugin "
                                         "with conflicting settings ("
                                         "non-unique keyword).") 
开发者ID:agile4you,项目名称:bottle-jwt,代码行数:30,代码来源:auth.py

示例7: setup

# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import PluginError [as 别名]
def setup(self, app):
        """ Make sure that other installed plugins don't affect the same
            keyword argument and check if metadata is available."""
        for other in app.plugins:
            if not isinstance(other, BeakerPlugin):
                continue
            if other.keyword == self.keyword:
                raise bottle.PluginError("Found another beaker plugin "
                                         "with conflicting settings ("
                                         "non-unique keyword).") 
开发者ID:morpheus65535,项目名称:bazarr,代码行数:12,代码来源:bottle_beaker.py


注:本文中的bottle.PluginError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。