1. Juergen Brendel
  2. django-piston-accept

Commits

Juergen Brendel  committed b9d90cc Draft

Deal with non existing response attribute

  • Participants
  • Parent commits 8151b45
  • Branches default

Comments (0)

Files changed (2)

File piston/authentication.py

View file
 
 class NoAuthentication(object):
     """
-    Authentication handler that always returns
+	Authentication handler that always returns
     True, so no authentication is needed, nor
     initiated (`challenge` is missing.)
     """

File piston/resource.py

View file
         except AttributeError:
             # We get here if there was no attached form
             serialized_errors = str(e)
-            print "@@@ serialized_errors: ", serialized_errors
 
         srl = emitter(serialized_errors, typemapper, self.handler, fields, False)
         stream = srl.render(request)
         # If we're looking at a response object which contains non-string
         # content, then assume we should use the emitter to format that 
         # content
-        if isinstance(result, HttpResponse) and not result._is_string:
+        if isinstance(result, HttpResponse) and (not hasattr(result, '_is_string') or result._is_string):
             status_code = result.status_code
             # Note: We can't use result.content here because that method attempts
             # to convert the content into a string which we don't want.