summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2013-08-29 23:03:56 -0400
committerChris McDonough <chrism@plope.com>2013-08-29 23:03:56 -0400
commit06f57f4616758f1f05cb0402fc970089d4483f28 (patch)
tree9a601f55e87ab3ee498ab70c3ec9d00e2ee32a28
parente744e9c33b076c9e078e0b8b53c600b6db46c831 (diff)
downloadpyramid-06f57f4616758f1f05cb0402fc970089d4483f28.tar.gz
pyramid-06f57f4616758f1f05cb0402fc970089d4483f28.tar.bz2
pyramid-06f57f4616758f1f05cb0402fc970089d4483f28.zip
fix the regex used by get_remainder_name, add tests for get_remainder_name
-rw-r--r--pyramid/tests/test_urldispatch.py11
-rw-r--r--pyramid/urldispatch.py2
2 files changed, 12 insertions, 1 deletions
diff --git a/pyramid/tests/test_urldispatch.py b/pyramid/tests/test_urldispatch.py
index 1755d9f47..ba5f2eeb5 100644
--- a/pyramid/tests/test_urldispatch.py
+++ b/pyramid/tests/test_urldispatch.py
@@ -522,6 +522,17 @@ class TestCompileRouteFunctional(unittest.TestCase):
self.generates('/foo/:_abc', {'_abc':'20'}, '/foo/20')
self.generates('/foo/:abc_def', {'abc_def':'20'}, '/foo/20')
+class Test_get_remainder_name(unittest.TestCase):
+ def _callFUT(self, pattern):
+ from pyramid.urldispatch import get_remainder_name
+ return get_remainder_name(pattern)
+
+ def test_it_nostararg(self):
+ self.assertEqual(self._callFUT('/bob'), None)
+
+ def test_it_withstararg(self):
+ self.assertEqual(self._callFUT('/bob*dean'), 'dean')
+
class DummyContext(object):
""" """
diff --git a/pyramid/urldispatch.py b/pyramid/urldispatch.py
index 621b6d939..75bff904d 100644
--- a/pyramid/urldispatch.py
+++ b/pyramid/urldispatch.py
@@ -92,7 +92,7 @@ class RoutesMapper(object):
# stolen from bobo and modified
old_route_re = re.compile(r'(\:[_a-zA-Z]\w*)')
-star_at_end = re.compile(r'(\*\w*)$')
+star_at_end = re.compile(r'\*(\w*)$')
# The tortuous nature of the regex named ``route_re`` below is due to the
# fact that we need to support at least one level of "inner" squigglies