diff options
-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) |