Created
October 25, 2013 12:54
-
-
Save saaj/7154231 to your computer and use it in GitHub Desktop.
Routes 1.13 capturing group fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ~/venv/1/lib/python2.7/site-packages/routes/route.py | |
+++ ~/venv/2/lib/python2.7/site-packages/routes/route.py | |
@@ -421,7 +421,7 @@ | |
# our regexp first. It's still possible we could be completely | |
# blank as we have a default | |
if self.reqs.has_key(var) and self.defaults.has_key(var): | |
- reg = '(?:' + partreg + rest + ')?' | |
+ reg = '(' + partreg + rest + ')?' | |
# Or we have a regexp match with no default, so now being | |
# completely blank form here on out isn't possible | |
@@ -452,7 +452,7 @@ | |
# something else in the chain does have req's though, we have | |
# to make the partreg here required to continue matching | |
if allblank and self.defaults.has_key(var): | |
- reg = '(?:' + partreg + rest + ')?' | |
+ reg = '(' + partreg + rest + ')?' | |
# Same as before, but they can't all be blank, so we have to | |
# require it all to ensure our matches line up right | |
@@ -488,7 +488,7 @@ | |
noreqs = False | |
elif part and part[-1] in self.done_chars: | |
if allblank: | |
- reg = re.escape(part[:-1]) + '(?:' + re.escape(part[-1]) + rest | |
+ reg = re.escape(part[:-1]) + '(' + re.escape(part[-1]) + rest | |
reg += ')?' | |
else: | |
allblank = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment