Joshua Ginsberg committed 7c90898

Piston now supports Django 1.4 - thanks andialbrecht - Fixes #214

Comments (0)

Files changed (3)


         `Resource` subclass.
         resp = rc.BAD_REQUEST
-        resp.write(' '+str(e.form.errors))
+        resp.write(u' '+unicode(e.form.errors))
         return resp
         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
     def cleanup_request(request):
 # 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


 import os
 DEBUG = True
+    'default':
+        {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': '/tmp/piston.db'
+    }
 DATABASE_ENGINE = 'sqlite3'
 DATABASE_NAME = '/tmp/piston.db'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.