本文整理汇总了Python中werkzeug.routing.Map.bind方法的典型用法代码示例。如果您正苦于以下问题:Python Map.bind方法的具体用法?Python Map.bind怎么用?Python Map.bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类werkzeug.routing.Map
的用法示例。
在下文中一共展示了Map.bind方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: refresh
# 需要导入模块: from werkzeug.routing import Map [as 别名]
# 或者: from werkzeug.routing.Map import bind [as 别名]
def refresh(self):
"""Rebinds and refreshes the URL. Call this if you modified the
rule in place.
:internal:
"""
self.bind(self.map, rebind=True)
示例2: bind
# 需要导入模块: from werkzeug.routing import Map [as 别名]
# 或者: from werkzeug.routing.Map import bind [as 别名]
def bind(self, map, rebind=False):
"""Bind the url to a map and create a regular expression based on
the information from the rule itself and the defaults from the map.
:internal:
"""
if self.map is not None and not rebind:
raise RuntimeError("url rule %r already bound to map %r" % (self, self.map))
self.map = map
if self.strict_slashes is None:
self.strict_slashes = map.strict_slashes
if self.subdomain is None:
self.subdomain = map.default_subdomain
self.compile()
示例3: add
# 需要导入模块: from werkzeug.routing import Map [as 别名]
# 或者: from werkzeug.routing.Map import bind [as 别名]
def add(self, rulefactory):
"""Add a new rule or factory to the map and bind it. Requires that the
rule is not bound to another map.
:param rulefactory: a :class:`Rule` or :class:`RuleFactory`
"""
for rule in rulefactory.get_rules(self):
rule.bind(self)
self._rules.append(rule)
self._rules_by_endpoint.setdefault(rule.endpoint, []).append(rule)
self._remap = True
示例4: bind
# 需要导入模块: from werkzeug.routing import Map [as 别名]
# 或者: from werkzeug.routing.Map import bind [as 别名]
def bind(self, map, rebind=False):
"""Bind the url to a map and create a regular expression based on
the information from the rule itself and the defaults from the map.
:internal:
"""
if self.map is not None and not rebind:
raise RuntimeError('url rule %r already bound to map %r' %
(self, self.map))
self.map = map
if self.strict_slashes is None:
self.strict_slashes = map.strict_slashes
if self.subdomain is None:
self.subdomain = map.default_subdomain
self.compile()