Why does Django not pass on error messages with the default 404 view?

2 views
Skip to first unread message

yakiimo

unread,
Oct 14, 2011, 4:15:02 AM10/14/11
to Django users
The docs (https://docs.djangoproject.com/en/dev/topics/http/views/
#customizing-error-views) state, "The page_not_found view should
suffice for 99% of Web applications, but if you want to override it,
you can specify handler404 in your URLconf".

The page_not_found view only passes on the requested URL and ignores
any message you provide when raising an exception. It seems to me that
having the *option* to provide helpful hints to the 404.html template
by default would be good for everyone.

Could someone explain the reasoning here? I'm currently making a
custom view, but maybe it's a bad idea in practice?

A more specific context: I'm using matrix URLs so the base resource is
a normal hierarchical URL followed by matrix options in the basic
format of:
;filter_type1=item:value,item:value;filter_type2=item:value...

So it is quite easy to provide helpful messages based on how far along
the parsing gets before having an error. Wouldn't it be good to pass
on a message such as the following examples?
"Allowed filter_types: type1, type2, type3." or "Allowed items for
filter_type a: item1, item2, item3."

Apologies if I missed this explanation elsewhere. I've looked.
Reply all
Reply to author
Forward
0 new messages