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


Python Rule.__init__方法代码示例

本文整理汇总了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)
开发者ID:Davmuz,项目名称:flask,代码行数:28,代码来源:wrappers.py

示例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
开发者ID:pomke,项目名称:Pangur,代码行数:15,代码来源:utils.py

示例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
开发者ID:imclab,项目名称:mediagoblin,代码行数:5,代码来源:routing.py

示例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)
开发者ID:IanLewis,项目名称:kay,代码行数:8,代码来源:routing.py

示例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
开发者ID:matejamateusz,项目名称:OLDPLOTTING_FLASK,代码行数:8,代码来源:flask_mime.py

示例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
开发者ID:pythonsnake,项目名称:MediaDwarf,代码行数:6,代码来源:routing.py

示例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)
开发者ID:ani625,项目名称:metareddit,代码行数:5,代码来源:routes.py

示例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)
开发者ID:Epictetus,项目名称:Shimehari,代码行数:4,代码来源:routing.py


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