本文整理汇总了Python中werkzeug.routing.Rule.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Rule.__init__方法的具体用法?Python Rule.__init__怎么用?Python Rule.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类werkzeug.routing.Rule
的用法示例。
在下文中一共展示了Rule.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from werkzeug.routing import Rule [as 别名]
# 或者: from werkzeug.routing.Rule import __init__ [as 别名]
def __init__(self, *args, **kwargs):
"""
:param view_func: a view function.
"""
# Setup OPTIONS parameter
methods = kwargs.pop("methods", ("GET",))
provide_automatic_options = False
if "OPTIONS" not in methods:
methods = tuple(methods) + ("OPTIONS",)
provide_automatic_options = True
kwargs["methods"] = methods
self.provide_automatic_options = provide_automatic_options
# Set the view function
endpoint = kwargs.get("endpoint", None)
view_func = kwargs.pop("view_func", None)
if not view_func:
if callable(endpoint):
view_func = endpoint
endpoint = endpoint.__name__
elif type(endpoint) is str:
view_func = import_string(endpoint)
self.view_func = view_func
kwargs["endpoint"] = endpoint
RuleBase.__init__(self, *args, **kwargs)
示例2: __init__
# 需要导入模块: from werkzeug.routing import Rule [as 别名]
# 或者: from werkzeug.routing.Rule import __init__ [as 别名]
def __init__(self, string, defaults=None, subdomain=None, methods=None,
build_only=False, endpoint=None, strict_slashes=None,
redirect_to=None, permission=None, template=None, func=None,
authRequired=False, expires=None, mimetype=None, nocache=False):
Rule.__init__(self, string, defaults, subdomain, methods, build_only,
endpoint, strict_slashes, redirect_to)
self.permission = permission
self.template = template
self.func = func
self.authRequired = authRequired
self.expires = expires
self.mimetype = mimetype
self.nocache = nocache
示例3: __init__
# 需要导入模块: from werkzeug.routing import Rule [as 别名]
# 或者: from werkzeug.routing.Rule import __init__ [as 别名]
def __init__(self, endpoint, url, controller):
Rule.__init__(self, url, endpoint=endpoint)
self.gmg_controller = controller
示例4: __init__
# 需要导入模块: from werkzeug.routing import Rule [as 别名]
# 或者: from werkzeug.routing.Rule import __init__ [as 别名]
def __init__(self, pattern, **kwargs):
try:
self.view = kwargs.pop('view')
except KeyError:
self.view = None
OriginalRule.__init__(self, pattern, **kwargs)
示例5: __init__
# 需要导入模块: from werkzeug.routing import Rule [as 别名]
# 或者: from werkzeug.routing.Rule import __init__ [as 别名]
def __init__(self, string, defaults=None, subdomain=None, methods=None,
build_only=False, endpoint=None, strict_slashes=None,
redirect_to=None, alias=False, host=None, mimetype=None):
_Rule.__init__(self, string, defaults, subdomain, methods, build_only,
endpoint, strict_slashes, redirect_to, alias, host)
self.mimetype = mimetype
示例6: __init__
# 需要导入模块: from werkzeug.routing import Rule [as 别名]
# 或者: from werkzeug.routing.Rule import __init__ [as 别名]
def __init__(self, endpoint, url, controller, match_slash=True):
Rule.__init__(self, url, endpoint=endpoint)
self.gmg_controller = controller
self.match_slash = match_slash
示例7: __init__
# 需要导入模块: from werkzeug.routing import Rule [as 别名]
# 或者: from werkzeug.routing.Rule import __init__ [as 别名]
def __init__(self, *args, **kwargs):
self.handler = kwargs.pop('handler', kwargs.get('endpoint', None))
WerkzeugRule.__init__(self, *args, **kwargs)
示例8: __init__
# 需要导入模块: from werkzeug.routing import Rule [as 别名]
# 或者: from werkzeug.routing.Rule import __init__ [as 别名]
def __init__(self, endpoint, methods=['get']):
Rule.__init__(self, '/', endpoint=endpoint, methods=methods)