Merge "Allow all RFC3986-specified characters in explicit path segments."

This commit is contained in:
Jenkins
2015-07-09 21:15:34 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 1 deletions

View File

@@ -42,7 +42,9 @@ def route(*args):
if not isinstance(route, six.string_types):
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(
'%s must be a valid path segment. Keep in mind '
'that path segments should not contain path separators '

View File

@@ -2208,6 +2208,13 @@ class TestExplicitRoute(PecanTestCase):
'path(with-parens)',
'path;with;semicolons',
'path:with:colons',
'v2.0',
'~username',
'somepath!',
'four*four',
'one+two',
'@twitterhandle',
'package=pecan'
):
handler = C()
route(C, path, handler)