diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-07-09 21:15:34 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-07-09 21:15:34 +0000 |
commit | cbcc8b3e511f8366aabb04b50ce5c482cfcbb6f3 (patch) | |
tree | 0991b60b943abe2bca37dc5c2e098b27dede34a7 | |
parent | f8cdcb7711a55b9fe0e5982ff9775740dc9742c6 (diff) | |
parent | 3faec0800eeb36499ead3e0f892201ff74ab8861 (diff) | |
download | pecan-cbcc8b3e511f8366aabb04b50ce5c482cfcbb6f3.tar.gz |
Merge "Allow all RFC3986-specified characters in explicit path segments."
-rw-r--r-- | pecan/routing.py | 4 | ||||
-rw-r--r-- | pecan/tests/test_base.py | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/pecan/routing.py b/pecan/routing.py index 29a294c..aed8ad5 100644 --- a/pecan/routing.py +++ b/pecan/routing.py @@ -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 ' diff --git a/pecan/tests/test_base.py b/pecan/tests/test_base.py index e42f1da..8558f82 100644 --- a/pecan/tests/test_base.py +++ b/pecan/tests/test_base.py @@ -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) |