summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-05-30 03:40:01 -0400
committerChris McDonough <chrism@plope.com>2011-05-30 03:40:01 -0400
commitf700c71817d3ab8b98149208e30e26de96616815 (patch)
tree5f45cc101a3e7de74da520c936c55b886fbce55f
parent8f521b387bcf28c9819c753856e33d1d782d3645 (diff)
parentbf08b3bf5b7b3b8fc5c3c9f3618a30e13ee5d7bb (diff)
downloadpyramid-f700c71817d3ab8b98149208e30e26de96616815.tar.gz
pyramid-f700c71817d3ab8b98149208e30e26de96616815.tar.bz2
pyramid-f700c71817d3ab8b98149208e30e26de96616815.zip
Merge branch 'master' of github.com:Pylons/pyramid
-rw-r--r--pyramid/tests/test_urldispatch.py4
-rw-r--r--pyramid/urldispatch.py6
2 files changed, 7 insertions, 3 deletions
diff --git a/pyramid/tests/test_urldispatch.py b/pyramid/tests/test_urldispatch.py
index 7df237aeb..ec45cb71e 100644
--- a/pyramid/tests/test_urldispatch.py
+++ b/pyramid/tests/test_urldispatch.py
@@ -366,6 +366,10 @@ class TestCompileRouteMatchFunctional(unittest.TestCase):
self.matches('*traverse', '/La%20Pe%C3%B1a/x',
{'traverse':(u'La Pe\xf1a', 'x')})
self.matches('/foo/:id.html', '/foo/bar.html', {'id':'bar'})
+ self.matches('/{num:[0-9]+}/*traverse', '/555/abc/def',
+ {'num':'555', 'traverse':('abc', 'def')})
+ self.matches('/{num:[0-9]*}/*traverse', '/555/abc/def',
+ {'num':'555', 'traverse':('abc', 'def')})
def test_generator_functional(self):
self.generates('', {}, '/')
diff --git a/pyramid/urldispatch.py b/pyramid/urldispatch.py
index 43bc7e50f..230b18e54 100644
--- a/pyramid/urldispatch.py
+++ b/pyramid/urldispatch.py
@@ -77,7 +77,7 @@ class RoutesMapper(object):
# stolen from bobo and modified
old_route_re = re.compile(r'(\:[a-zA-Z]\w*)')
-star_in_brackets = re.compile(r'\{[^\}]*\*\w*[^\}]*\}')
+star_at_end = re.compile(r'\*\w*$')
# The torturous 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
@@ -97,9 +97,9 @@ def _compile_route(route):
route = '/' + route
star = None
-
- if '*' in route and not star_in_brackets.search(route):
+ if star_at_end.search(route):
route, star = route.rsplit('*', 1)
+
pat = route_re.split(route)
pat.reverse()
rpat = []