From: Andi Albrecht
Subject: Piston now supports Django 1.4
 Support for Django 1.4
Origin: upstream, https://bitbucket.org/jespern/django-piston/changeset/7c90898072ce
Bug: https://bitbucket.org/jespern/django-piston/issue/214/django-14-compatibility

--- python-django-piston-0.2.3.orig/piston/resource.py	2012-06-27 12:43:54.384489691 -0400
+++ python-django-piston-0.2.3/piston/resource.py	2012-06-27 12:45:00.316491380 -0400
@@ -73,7 +73,7 @@
         `Resource` subclass.
         """
         resp = rc.BAD_REQUEST
-        resp.write(' '+str(e.form.errors))
+        resp.write(u' '+unicode(e.form.errors))
         return resp
 
     @property
@@ -220,9 +220,9 @@
         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
         else:
-            return result._is_string
+            return not result._is_string
 
     @staticmethod
     def cleanup_request(request):
--- python-django-piston-0.2.3.orig/piston/tests.py	2011-11-01 09:52:13.000000000 -0400
+++ python-django-piston-0.2.3/piston/tests.py	2012-06-27 12:45:00.320491380 -0400
@@ -1,4 +1,5 @@
 # Django imports
+import django
 from django.core import mail
 from django.contrib.auth.models import User
 from django.conf import settings
@@ -100,7 +101,8 @@
          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
--- python-django-piston-0.2.3.orig/tests/test_project/settings.py	2011-11-01 09:52:13.000000000 -0400
+++ python-django-piston-0.2.3/tests/test_project/settings.py	2012-06-27 12:45:00.320491380 -0400
@@ -1,5 +1,12 @@
 import os
 DEBUG = True
+DATABASES = {
+    'default':
+        {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': '/tmp/piston.db'
+    }
+}
 DATABASE_ENGINE = 'sqlite3'
 DATABASE_NAME = '/tmp/piston.db'
 INSTALLED_APPS = (
