summaryrefslogtreecommitdiff
path: root/django/utils/regex_helper.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-08-31 17:20:40 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-08-31 17:20:40 +0000
commite1ea7014ad0a0f17c339fb1c1cc3e269ce87e31c (patch)
treeaf943211c50918e753b093e9377286eb5c582b0b /django/utils/regex_helper.py
parent30c7ce90c5b518696859fc667aa2996d0e7a43e4 (diff)
Fixed #8725 -- Handle empty URL patterns in reverse().
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8763 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/regex_helper.py')
-rw-r--r--django/utils/regex_helper.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/utils/regex_helper.py b/django/utils/regex_helper.py
index 3e3d349433..181285da4f 100644
--- a/django/utils/regex_helper.py
+++ b/django/utils/regex_helper.py
@@ -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.
- ch, escaped = pattern_iter.next()
+ try:
+ ch, escaped = pattern_iter.next()
+ except StopIteration:
+ return zip([''], [[]])
+
try:
while True:
if escaped: