Fix our url converters to not be silly
This commit is contained in:
parent
73e323c4d6
commit
1ef7008d85
1 changed files with 5 additions and 4 deletions
9
app.py
9
app.py
|
@ -128,15 +128,16 @@ app.request_class = RequestWithId
|
||||||
# Register custom converters.
|
# Register custom converters.
|
||||||
class RegexConverter(BaseConverter):
|
class RegexConverter(BaseConverter):
|
||||||
""" Converter for handling custom regular expression patterns in paths. """
|
""" Converter for handling custom regular expression patterns in paths. """
|
||||||
def __init__(self, url_map, *items):
|
def __init__(self, url_map, regex_value):
|
||||||
super(RegexConverter, self).__init__(url_map)
|
super(RegexConverter, self).__init__(url_map)
|
||||||
self.regex = items[0]
|
self.regex = regex_value
|
||||||
|
|
||||||
|
|
||||||
class RepositoryPathConverter(BaseConverter):
|
class RepositoryPathConverter(BaseConverter):
|
||||||
""" Converter for handling repository paths. Handles both library and non-library paths (if
|
""" Converter for handling repository paths. Handles both library and non-library paths (if
|
||||||
configured).
|
configured).
|
||||||
"""
|
"""
|
||||||
def __init__(self, url_map, *items):
|
def __init__(self, url_map):
|
||||||
super(RepositoryPathConverter, self).__init__(url_map)
|
super(RepositoryPathConverter, self).__init__(url_map)
|
||||||
self.weight = 200
|
self.weight = 200
|
||||||
|
|
||||||
|
@ -150,7 +151,7 @@ class RepositoryPathConverter(BaseConverter):
|
||||||
class APIRepositoryPathConverter(BaseConverter):
|
class APIRepositoryPathConverter(BaseConverter):
|
||||||
""" Converter for handling repository paths. Does not handle library paths.
|
""" Converter for handling repository paths. Does not handle library paths.
|
||||||
"""
|
"""
|
||||||
def __init__(self, url_map, *items):
|
def __init__(self, url_map):
|
||||||
super(APIRepositoryPathConverter, self).__init__(url_map)
|
super(APIRepositoryPathConverter, self).__init__(url_map)
|
||||||
self.weight = 200
|
self.weight = 200
|
||||||
self.regex = r'([^/]+/[^/]+)'
|
self.regex = r'([^/]+/[^/]+)'
|
||||||
|
|
Reference in a new issue