Loading django/utils/regex_helper.py +5 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,11 @@ def normalize(pattern): # A "while" loop is used here because later on we need to be able to peek # at the next character and possibly go around without consuming another # one at the top of the loop. try: ch, escaped = pattern_iter.next() except StopIteration: return zip([''], [[]]) try: while True: if escaped: Loading tests/regressiontests/urlpatterns_reverse/extra_urls.py 0 → 100644 +11 −0 Original line number Diff line number Diff line """ Some extra URL patterns that are included at the top level. """ from django.conf.urls.defaults import * from views import empty_view urlpatterns = patterns('', url(r'^e-places/(\d+)/$', empty_view, name='extra-places'), url(r'^e-people/(?P<name>\w+)/$', empty_view, name="extra-people"), ) tests/regressiontests/urlpatterns_reverse/tests.py +3 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,9 @@ test_data = ( ('inner-extra', NoReverseMatch, ['fred', 'inner'], {}), ('disjunction', NoReverseMatch, ['foo'], {}), ('inner-disjunction', NoReverseMatch, ['10', '11'], {}), ('extra-places', '/e-places/10/', ['10'], {}), ('extra-people', '/e-people/fred/', ['fred'], {}), ('extra-people', '/e-people/fred/', [], {'name': 'fred'}), ) class URLPatternReverse(TestCase): Loading tests/regressiontests/urlpatterns_reverse/urls.py +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ urlpatterns = patterns('', url(r'^(?i)test/2/?$', empty_view, name="test2"), url(r'^outer/(?P<outer>\d+)/', include('regressiontests.urlpatterns_reverse.included_urls')), url('', include('regressiontests.urlpatterns_reverse.extra_urls')), # This is non-reversible, but we shouldn't blow up when parsing it. url(r'^(?:foo|bar)(\w+)/$', empty_view, name="disjunction"), Loading Loading
django/utils/regex_helper.py +5 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,11 @@ def normalize(pattern): # A "while" loop is used here because later on we need to be able to peek # at the next character and possibly go around without consuming another # one at the top of the loop. try: ch, escaped = pattern_iter.next() except StopIteration: return zip([''], [[]]) try: while True: if escaped: Loading
tests/regressiontests/urlpatterns_reverse/extra_urls.py 0 → 100644 +11 −0 Original line number Diff line number Diff line """ Some extra URL patterns that are included at the top level. """ from django.conf.urls.defaults import * from views import empty_view urlpatterns = patterns('', url(r'^e-places/(\d+)/$', empty_view, name='extra-places'), url(r'^e-people/(?P<name>\w+)/$', empty_view, name="extra-people"), )
tests/regressiontests/urlpatterns_reverse/tests.py +3 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,9 @@ test_data = ( ('inner-extra', NoReverseMatch, ['fred', 'inner'], {}), ('disjunction', NoReverseMatch, ['foo'], {}), ('inner-disjunction', NoReverseMatch, ['10', '11'], {}), ('extra-places', '/e-places/10/', ['10'], {}), ('extra-people', '/e-people/fred/', ['fred'], {}), ('extra-people', '/e-people/fred/', [], {'name': 'fred'}), ) class URLPatternReverse(TestCase): Loading
tests/regressiontests/urlpatterns_reverse/urls.py +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ urlpatterns = patterns('', url(r'^(?i)test/2/?$', empty_view, name="test2"), url(r'^outer/(?P<outer>\d+)/', include('regressiontests.urlpatterns_reverse.included_urls')), url('', include('regressiontests.urlpatterns_reverse.extra_urls')), # This is non-reversible, but we shouldn't blow up when parsing it. url(r'^(?:foo|bar)(\w+)/$', empty_view, name="disjunction"), Loading