summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-08-15 22:52:19 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-08-15 22:53:52 +0200
commit27d16a3ca4a330f5aa46015ccd7d5a9ee72873b6 (patch)
tree5677ecd29da2e684aa07f955a9ecf25bd5cc6707
parent24de85c419ed46baf95098822f3f455887bc00f6 (diff)
[py3] Fixed middleware_exceptions tests.
-rw-r--r--django/core/handlers/base.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py
index 3fc40358d0..791382bac0 100644
--- a/django/core/handlers/base.py
+++ b/django/core/handlers/base.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
import sys
+import types
from django import http
from django.core import signals
@@ -125,10 +126,10 @@ class BaseHandler(object):
# Complain if the view returned None (a common error).
if response is None:
- try:
- view_name = callback.func_name # If it's a function
- except AttributeError:
- view_name = callback.__class__.__name__ + '.__call__' # If it's a class
+ if isinstance(callback, types.FunctionType): # FBV
+ view_name = callback.__name__
+ else: # CBV
+ view_name = callback.__class__.__name__ + '.__call__'
raise ValueError("The view %s.%s didn't return an HttpResponse object." % (callback.__module__, view_name))
# If the response supports deferred rendering, apply template