#10834: BaseHandler does not handle resolver returning None
------------------------------------+---------------------------------------
Reporter: xerolas | Owner: ccahoon
Status: reopened | Milestone: 1.1
Component: HTTP handling | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Comment (by ccahoon):
That's very interesting. I was able to recreate showing the Welcome to
Django screen if the following urlpattern is not covered:
{{{
r'^$'
}}}
However, the other urls still functioned properly. I looked around and it
looks like it is because of this code in django/views/debug.py (this is on
trunk r11126):
{{{
244 def technical_404_response(request, exception):
245 "Create a technical 404 error response. The exception should be
the
Http404."
246 try:
247 tried = exception.args[0]['tried']
248 except (IndexError, TypeError):
249 tried = []
250 else:
251 if not tried:
252 # tried exists but is an empty list. The URLconf must've
been
empty.
253 return empty_urlconf(request)
}}}
The content of the changeset (which was different from my patch) creates
an empty "tried" list in the dictionary returned in the Resolver404
exception. Thus, debug thinks there is nothing in the urlconf. Attaching a
patch.
I am pretty sure I ran into this issue when creating the fix -- only by
not even having "tried" in the dictionary does the 404 behave properly.
Now I am not sure if this is correct overall behavior, but for a patch
this small, it seemed appropriate to just leave it out.
--
Ticket URL: <http://code.djangoproject.com/ticket/10834#comment:11>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---