Changed reverse URL resolving to handle the case where an included file does

not have a urlpatterns attribute.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5538 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-06-25 16:19:36 +00:00
parent 85f6f15263
commit b8b9c95dca
1 changed files with 1 additions and 1 deletions

View File

@ -201,7 +201,7 @@ class RegexURLResolver(object):
self._reverse_dict = {} self._reverse_dict = {}
def _get_reverse_dict(self): def _get_reverse_dict(self):
if not self._reverse_dict: if not self._reverse_dict and hasattr(self.urlconf_module, 'urlpatterns'):
for pattern in reversed(self.urlconf_module.urlpatterns): for pattern in reversed(self.urlconf_module.urlpatterns):
if isinstance(pattern, RegexURLResolver): if isinstance(pattern, RegexURLResolver):
for key, value in pattern.reverse_dict.iteritems(): for key, value in pattern.reverse_dict.iteritems():