Ticket #7117: commit-454b8e2

File commit-454b8e2, 1.4 KB (added by Bastian Kleineidam <calvin@…>, 17 years ago)
Line 
1diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py
2index fd7e1bb..00ee309 100644
3--- a/django/core/urlresolvers.py
4+++ b/django/core/urlresolvers.py
5@@ -86,7 +86,7 @@ def reverse_helper(regex, *args, **kwargs):
6 """
7 # TODO: Handle nested parenthesis in the following regex.
8 result = re.sub(r'\(([^)]+)\)', MatchChecker(args, kwargs), regex.pattern)
9- return result.replace('^', '').replace('$', '')
10+ return result.replace('^', '').replace('$', '').replace('\\', '')
11
12 class MatchChecker(object):
13 "Class used in reverse RegexURLPattern lookup."
14diff --git a/tests/regressiontests/urlpatterns_reverse/tests.py b/tests/regressiontests/urlpatterns_reverse/tests.py
15index 8f571ac..610c3f7 100644
16--- a/tests/regressiontests/urlpatterns_reverse/tests.py
17+++ b/tests/regressiontests/urlpatterns_reverse/tests.py
18@@ -17,6 +17,7 @@ test_data = (
19 ('^hardcoded/$', 'hardcoded/', [], {}),
20 ('^hardcoded/$', 'hardcoded/', ['any arg'], {}),
21 ('^hardcoded/$', 'hardcoded/', [], {'kwarg': 'foo'}),
22+ ('^hardcoded/doc\\.pdf$', 'hardcoded/doc.pdf', [], {}),
23 ('^people/(?P<state>\w\w)/(?P<name>\w+)/$', 'people/il/adrian/', [], {'state': 'il', 'name': 'adrian'}),
24 ('^people/(?P<state>\w\w)/(?P<name>\d)/$', NoReverseMatch, [], {'state': 'il', 'name': 'adrian'}),
25 ('^people/(?P<state>\w\w)/(?P<name>\w+)/$', NoReverseMatch, [], {'state': 'il'}),
Back to Top