Commits

derschreckliche committed ce1d26b

Added a hack to support all kinds of HttpResponse

Comments (0)

Files changed (1)

djangorators/rendering.py

 from django.views.generic.simple import direct_to_template
-from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
+from django.http import HttpResponse
 
 def as_html(template_name):
     def wrap(func):
         def _dec(request, *args, **kwargs):
             response = func(request, *args, **kwargs)
-            # TODO: add more, or even better find an elegant hack :)
-            http_responses = (HttpResponse, HttpResponseRedirect, HttpResponseNotFound)
-            if isinstance(response, http_responses):
+            if issubclass(response.__class__, HttpResponse):
                 return response
             # Otherwise, the response is a context which is rendered
             return direct_to_template(request, template_name, response)