Commits

Waldemar Kornewald committed a4dc936

Renamed json to http because it contains other response types.

Comments (0)

Files changed (4)

+from django.conf import settings
+from django.core.serializers.json import DjangoJSONEncoder
+from django.http import HttpResponse
+from django.utils import simplejson
+from django.utils.encoding import force_unicode
+from django.utils.functional import Promise
+
+class LazyEncoder(DjangoJSONEncoder):
+    def default(self, obj):
+        if isinstance(obj, Promise):
+            return force_unicode(obj)
+        return super(LazyEncoder, self).default(obj)
+
+class JSONResponse(HttpResponse):
+    def __init__(self, pyobj, **kwargs):
+        super(JSONResponse, self).__init__(
+            simplejson.dumps(pyobj, cls=LazyEncoder),
+            content_type='application/json; charset=%s' %
+                            settings.DEFAULT_CHARSET,
+            **kwargs)
+
+class TextResponse(HttpResponse):
+    def __init__(self, string='', **kwargs):
+        super(TextResponse, self).__init__(string,
+            content_type='text/plain; charset=%s' % settings.DEFAULT_CHARSET,
+            **kwargs)

json.py

-from django.conf import settings
-from django.core.serializers.json import DjangoJSONEncoder
-from django.http import HttpResponse
-from django.utils import simplejson
-from django.utils.encoding import force_unicode
-from django.utils.functional import Promise
-
-class LazyEncoder(DjangoJSONEncoder):
-    def default(self, obj):
-        if isinstance(obj, Promise):
-            return force_unicode(obj)
-        return super(LazyEncoder, self).default(obj)
-
-class JSONResponse(HttpResponse):
-    def __init__(self, pyobj, **kwargs):
-        super(JSONResponse, self).__init__(
-            simplejson.dumps(pyobj, cls=LazyEncoder),
-            content_type='application/json; charset=%s' %
-                            settings.DEFAULT_CHARSET,
-            **kwargs)
-
-class TextResponse(HttpResponse):
-    def __init__(self, string='', **kwargs):
-        super(TextResponse, self).__init__(string,
-            content_type='text/plain; charset=%s' % settings.DEFAULT_CHARSET,
-            **kwargs)
 from .utils import object_list_to_table, equal_lists
-from django.test import TestCase as DjangoTestCase
-from google.appengine.ext import db
-import os
-import unittest
-
-class TestCase(DjangoTestCase):
-    def setUp(self):
-        self.setup()
-
-    def tearDown(self):
-        self.teardown()
-
-    def setup(self):
-        pass
-
-    def teardown(self):
-        pass
+from django.test import TestCase
 
 class ModelTestCase(TestCase):
     """
-from django.utils._threading_local import local
+from threading import local
 
 def make_tls_property(default=None):
     """Creates a class-wide instance property with a thread-specific value."""