當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。