diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-11-28 22:58:10 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-11-28 22:58:10 +0000 |
| commit | e1d23323b631436eaae78bb5e4676d83c97d7a6c (patch) | |
| tree | 52923e96dc5b773e8e959c5d8cafdd4cf650373c | |
| parent | 9c44d8b60b21ac2c5b05473ef88380037d926435 (diff) | |
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
| -rw-r--r-- | django/core/handlers/base.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py index c1403ea4fa..85473a6353 100644 --- a/django/core/handlers/base.py +++ b/django/core/handlers/base.py @@ -84,7 +84,11 @@ class BaseHandler(object): # Complain if the view returned None (a common error). 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 except http.Http404, e: |
