Пример #1
0
    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
    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
 def __init__(self, context, *args, **kwargs):
     content = dumps(context)
     super(JsonResponse, self).__init__(content, *args, **kwargs)
     self['Content-Type'] = 'application/json'
Пример #4
0
 def encode_and_decode(self, v):
     return json.loads(dumps(v))
Пример #5
0
 def serialize(self, obj):
     """
     Returns a json serialized string object encoded using
     `argonauts.serializers.JSONArgonautsEncoder`.
     """
     return dumps(obj)
Пример #6
0
 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
 def encode_and_decode(self, v):
     return json.loads(dumps(v))