Friday, October 14, 2011

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

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.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate