summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2010-11-07 16:02:22 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2010-11-07 16:02:22 +0000
commit96cc7baf0c6bc043e32d1972f95962045a7fba2b (patch)
treeefbdb2dedfb514968ee0d40155f560aa3e889b01 /django
parent035cb99b47d8580b2619788fb08eed9cf7968590 (diff)
Fixed #13684 -- if settings.ROOT_URLCONF isn't defined don't blow up with an UnboundLocalError.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14488 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/core/handlers/base.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py
index 6002d54443..81f0a9ef3a 100644
--- a/django/core/handlers/base.py
+++ b/django/core/handlers/base.py
@@ -73,13 +73,15 @@ class BaseHandler(object):
from django.conf import settings
try:
+ # Setup default url resolver for this thread, this code is outside
+ # the try/except so we don't get a spurious "unbound local
+ # variable" exception in the event an exception is raised before
+ # resolver is set
+ urlconf = settings.ROOT_URLCONF
+ urlresolvers.set_urlconf(urlconf)
+ resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
try:
- # Setup default url resolver for this thread.
- urlconf = settings.ROOT_URLCONF
- urlresolvers.set_urlconf(urlconf)
- resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
response = None
-
# Apply request middleware
for middleware_method in self._request_middleware:
response = middleware_method(request)
@@ -239,4 +241,3 @@ def get_script_name(environ):
if script_url:
return force_unicode(script_url[:-len(environ.get('PATH_INFO', ''))])
return force_unicode(environ.get('SCRIPT_NAME', u''))
-