Kaydet (Commit) 27d16a3c authored tarafından Aymeric Augustin's avatar Aymeric Augustin

[py3] Fixed middleware_exceptions tests.

üst 24de85c4
from __future__ import unicode_literals from __future__ import unicode_literals
import sys import sys
import types
from django import http from django import http
from django.core import signals from django.core import signals
...@@ -125,10 +126,10 @@ class BaseHandler(object): ...@@ -125,10 +126,10 @@ 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:
try: if isinstance(callback, types.FunctionType): # FBV
view_name = callback.func_name # If it's a function view_name = callback.__name__
except AttributeError: else: # CBV
view_name = callback.__class__.__name__ + '.__call__' # If it's a class view_name = callback.__class__.__name__ + '.__call__'
raise ValueError("The view %s.%s didn't return an HttpResponse object." % (callback.__module__, view_name)) raise ValueError("The view %s.%s didn't return an HttpResponse object." % (callback.__module__, view_name))
# If the response supports deferred rendering, apply template # If the response supports deferred rendering, apply template
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment