本文整理汇总了Python中werkzeug.routing.BaseConverter类的典型用法代码示例。如果您正苦于以下问题:Python BaseConverter类的具体用法?Python BaseConverter怎么用?Python BaseConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseConverter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, url_map):
BaseConverter.__init__(self, url_map)
self.regex = r'(?i)(?:WQL)'
示例2: __init__
def __init__(self, map):
BaseConverter.__init__(self, map)
self.regex = '(?:%s)' % '|'.join([re.escape(x) for x in NEWS_URLS])
示例3: to_url
def to_url(self, value):
"""Convert datetime to string."""
return BaseConverter.to_url(self, str(value))
示例4: __init__
def __init__(self, url_map):
BaseConverter.__init__(self, url_map)
self.regex = '(?:%s)' % '|'.join([re.escape(x) for x in items])
示例5: __init__
def __init__(self, map):
BaseConverter.__init__(self, map)
self.regex = '\w+(?:-\w+)*'
示例6: __init__
def __init__(self, map):
BaseConverter.__init__(self, map)
self.fixed_digits = 64
示例7: __init__
def __init__(self, url_map, ext):
BaseConverter.__init__(self, url_map)
self.regex = '[^/].*?(?:{})'.format(ext)
示例8: to_url
def to_url(self, values):
return ",".join([BaseConverter.to_url(value) for value in values])
示例9: to_url
def to_url(self, values):
if len(values) > 2: # Strip out everything extra
values = values[:2]
return ':'.join(BaseConverter.to_url(value)
for value in values)
示例10: to_url
def to_url(self, values):
"""Return string."""
return '+'.join(BaseConverter.to_url(value)
for value in values)
示例11: __init__
def __init__(self, map, *args):
BaseConverter.__init__(self,map)
self.map = map
self.regex = args[0]
示例12: to_url
def to_url(self, values):
return "[{0}]".format(
','.join(BaseConverter.to_url(value) for value in values) #pylint: disable=no-value-for-parameter
)
示例13: __init__
def __init__(self, mapping, *items):
BaseConverter.__init__(self, mapping)
# Start by enforcing that x is an integer then convert it to string
self.regex = '(?:%s)' % '|'.join([str(int(x)) for x in items])
示例14: to_url
def to_url(self, values):
"""
被url_for()调用,来转换参数成为符合URL的形式
"""
return '+'.join(BaseConverter.to_url(value)
for value in values)
示例15: to_url
def to_url(self, value):
return BaseConverter.to_url(value)