summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Petrello <lists@ryanpetrello.com>2015-06-25 10:45:48 -0400
committerRyan Petrello <lists@ryanpetrello.com>2015-06-25 10:45:48 -0400
commit3faec0800eeb36499ead3e0f892201ff74ab8861 (patch)
tree384f3cc19b4f262c212bd30b3bbabdfb9cfa3a02
parent0001a9d94da76545991afbfb5274e8b8bacac888 (diff)
downloadpecan-3faec0800eeb36499ead3e0f892201ff74ab8861.tar.gz
Allow all RFC3986-specified characters in explicit path segments.
Change-Id: I37635b153bde00e47904f94ed212e03f4dd708e9
-rw-r--r--pecan/routing.py4
-rw-r--r--pecan/tests/test_base.py7
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 785b522..5baab91 100644
--- a/pecan/tests/test_base.py
+++ b/pecan/tests/test_base.py
@@ -2231,6 +2231,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)