Kristian Bendiksen  committed cb5446b

Fix django v. 1.4 support (again!).

  • Participants
  • Parent commits fddaa45
  • Branches default

Comments (0)

Files changed (2)

File piston/

             # to convert the content into a string which we don't want. 
             # when _base_content_is_iter it True _container is the raw data
             result = result._container
         srl = emitter(result, typemapper, handler, fields, anonymous)
         if not isinstance(result, HttpResponse):
             return False
         elif django.VERSION >= (1, 4):
-            return not result._base_content_is_iter
+            return result._base_content_is_iter
-            return result._is_string
+            return not result._is_string

File piston/

 # Django imports
+import django
 from django.core import mail
 from django.contrib.auth.models import User
 from django.conf import settings
          response = resource(request, emitter_format='json')
          self.assertEquals(201, response.status_code)
-         self.assertTrue(response._is_string, "Expected response content to be a string")
+         is_string = (not response._base_content_is_iter) if django.VERSION >= (1,4) else response._is_string
+         self.assert_(is_string, "Expected response content to be a string")
          # compare the original data dict with the json response 
          # converted to a dict