Ticket #11970: patch.diff

File patch.diff, 1.1 KB (added by Malcolm Box, 15 years ago)

Fix for problem

  • server/lib/django-1.1/django/core/serializers/json.py

    diff --git a/server/lib/django-1.1/django/core/serializers/json.py b/server/lib/django-1.1/django/core/serializers/json.py
    index 97e5bc9..df5c304 100644
    a b from StringIO import StringIO  
    77
    88from django.core.serializers.python import Serializer as PythonSerializer
    99from django.core.serializers.python import Deserializer as PythonDeserializer
     10from django.core.serializers import base
    1011from django.utils import datetime_safe
    1112from django.utils import simplejson
    1213
    def Deserializer(stream_or_string, **options):  
    3839        stream = StringIO(stream_or_string)
    3940    else:
    4041        stream = stream_or_string
    41     for obj in PythonDeserializer(simplejson.load(stream)):
    42         yield obj
     42    try:
     43        for obj in PythonDeserializer(simplejson.load(stream)):
     44            yield obj
     45    except ValueError, e:
     46        # Map to deserializer error
     47        raise base.DeserializationError(e.args)
    4348
    4449class DjangoJSONEncoder(simplejson.JSONEncoder):
    4550    """
Back to Top