Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed small bug in 'The view ____ didn't return an HttpResponse objec…

…t' 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
  • Loading branch information...
commit e1d23323b631436eaae78bb5e4676d83c97d7a6c 1 parent 9c44d8b
Adrian Holovaty authored November 28, 2006

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. 6  django/core/handlers/base.py
6  django/core/handlers/base.py
@@ -84,7 +84,11 @@ def get_response(self, request):
84 84
 
85 85
             # Complain if the view returned None (a common error).
86 86
             if response is None:
87  
-                raise ValueError, "The view %s.%s didn't return an HttpResponse object." % (callback.__module__, callback.func_name)
  87
+                try:
  88
+                    view_name = callback.func_name # If it's a function
  89
+                except AttributeError:
  90
+                    view_name = callback.__class__.__name__ + '.__call__' # If it's a class
  91
+                raise ValueError, "The view %s.%s didn't return an HttpResponse object." % (callback.__module__, view_name)
88 92
 
89 93
             return response
90 94
         except http.Http404, e:

0 notes on commit e1d2332

Please sign in to comment.
Something went wrong with that request. Please try again.