Fixed small bug in 'The view ____ didn't return an HttpResponse object' message -- it assumed the view was a function, whereas it can be any callable object

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4128 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-11-28 22:58:10 +00:00
parent 9c44d8b60b
commit e1d23323b6
1 changed files with 5 additions and 1 deletions

View File

@ -84,7 +84,11 @@ class BaseHandler(object):
# Complain if the view returned None (a common error). # Complain if the view returned None (a common error).
if response is None: if response is None:
raise ValueError, "The view %s.%s didn't return an HttpResponse object." % (callback.__module__, callback.func_name) try:
view_name = callback.func_name # If it's a function
except AttributeError:
view_name = callback.__class__.__name__ + '.__call__' # If it's a class
raise ValueError, "The view %s.%s didn't return an HttpResponse object." % (callback.__module__, view_name)
return response return response
except http.Http404, e: except http.Http404, e: