コード例 #1
0
ファイル: tests.py プロジェクト: pombredanne/django-argonauts
    def test_attribute_error(self):

        class Klass(object):
            def __init__(self, i):
                self.value = i

            def to_json(self):
                # Value is an int() it doesn't have a pk
                return {'value': self.value.pk}

        with self.assertRaises(AttributeError):
            dumps(Klass(5))
コード例 #2
0
ファイル: tests.py プロジェクト: wojas/django-argonauts
    def test_attribute_error(self):

        class Klass(object):
            def __init__(self, i):
                self.value = i

            def to_json(self):
                # Value is an int() it doesn't have a pk
                return {'value': self.value.pk}

        with self.assertRaises(AttributeError):
            dumps(Klass(5))
コード例 #3
0
ファイル: http.py プロジェクト: CashStar/django-argonauts
 def __init__(self, context, *args, **kwargs):
     content = dumps(context)
     super(JsonResponse, self).__init__(content, *args, **kwargs)
     self['Content-Type'] = 'application/json'
コード例 #4
0
ファイル: tests.py プロジェクト: wojas/django-argonauts
 def encode_and_decode(self, v):
     return json.loads(dumps(v))
コード例 #5
0
ファイル: views.py プロジェクト: CashStar/django-argonauts
 def serialize(self, obj):
     """
     Returns a json serialized string object encoded using
     `argonauts.serializers.JSONArgonautsEncoder`.
     """
     return dumps(obj)
コード例 #6
0
ファイル: views.py プロジェクト: graingert/django-argonauts
 def serialize(self, obj):
     """
     Returns a json serialized string object encoded using
     `argonauts.serializers.JSONArgonautsEncoder`.
     """
     return dumps(obj)
コード例 #7
0
 def __init__(self, context, *args, **kwargs):
     content = dumps(context)
     super(JsonResponse, self).__init__(content, *args, **kwargs)
     self['Content-Type'] = 'application/json'
コード例 #8
0
ファイル: tests.py プロジェクト: pombredanne/django-argonauts
 def encode_and_decode(self, v):
     return json.loads(dumps(v))