Merge "Allow all RFC3986-specified characters in explicit path segments."
This commit is contained in:
@@ -42,7 +42,9 @@ def route(*args):
|
|||||||
if not isinstance(route, six.string_types):
|
if not isinstance(route, six.string_types):
|
||||||
raise TypeError('%s must be a string' % route)
|
raise TypeError('%s must be a string' % route)
|
||||||
|
|
||||||
if not re.match('^[0-9a-zA-Z-_$\(\),;:]+$', route):
|
if route in ('.', '..') or not re.match(
|
||||||
|
'^[0-9a-zA-Z-_$\(\)\.~!,;:*+@=]+$', route
|
||||||
|
):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'%s must be a valid path segment. Keep in mind '
|
'%s must be a valid path segment. Keep in mind '
|
||||||
'that path segments should not contain path separators '
|
'that path segments should not contain path separators '
|
||||||
|
@@ -2208,6 +2208,13 @@ class TestExplicitRoute(PecanTestCase):
|
|||||||
'path(with-parens)',
|
'path(with-parens)',
|
||||||
'path;with;semicolons',
|
'path;with;semicolons',
|
||||||
'path:with:colons',
|
'path:with:colons',
|
||||||
|
'v2.0',
|
||||||
|
'~username',
|
||||||
|
'somepath!',
|
||||||
|
'four*four',
|
||||||
|
'one+two',
|
||||||
|
'@twitterhandle',
|
||||||
|
'package=pecan'
|
||||||
):
|
):
|
||||||
handler = C()
|
handler = C()
|
||||||
route(C, path, handler)
|
route(C, path, handler)
|
||||||
|
Reference in New Issue
Block a user