Currently, we perform a sanity check to provide a useful error message
if a view returns None:

https://github.com/django/django/blob/1101467ce0756272a54f4c7bc65c4c335a94111b/django/core/handlers/base.py#L138

However, if a view returns a different object (say, a string), we
don't have a similarly useful message.

This is a very common newcomer mistake, and it causes immense frustration.

I have just had a third student encounter this problem and feel
completely blocked by it, so I think it's time to bring it to the
list.

I suggest that we add a try block, catching AttributeError, and
wrapping it, adding to the beginning of the message, "The object
returned by the view was not compatible with the Django http
subsystem.  Remember: views must return HttpResponse objects."

Also, similar to the new error messages accompanying the app object, I
want to suggest that we add a link to the document describing this.

I imagine that this has been a discussion before, but I can't find a
ticket.  Is there one?


-- 
Justin Holmes
Chief Chocobo Breeder, slashRoot

slashRoot: Coffee House and Tech Dojo
New Paltz, NY 12561
845.633.8330

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMGywB7qKQ02AvDV_mZWDhPET%3DJbqOX0O82dS7cycZLKSWKWWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to