Ticket #4227: core_serializers.diff

File core_serializers.diff, 1.5 KB (added by Caspar Hasenclever <hasencle@…>, 18 years ago)

output of svn diff in trunk/django/core/serializers/

  • xml_serializer.py

     
    6868        # serializer base class).
    6969        if getattr(obj, field.name) is not None:
    7070            value = self.get_string_value(obj, field)
    71             self.xml.characters(str(value))
     71            self.xml.characters(value)
    7272        else:
    7373            self.xml.addQuickElement("None")
    7474
     
    226226            inner_text.extend(getInnerText(child))
    227227        else:
    228228           pass
    229     return "".join(inner_text)
    230  No newline at end of file
     229    return "".join(inner_text)
  • base.py

     
    77except ImportError:
    88    from StringIO import StringIO
    99from django.db import models
     10from django.conf import settings
    1011
    1112class SerializationError(Exception):
    1213    """Something bad happened during serialization."""
     
    5960            value = getattr(obj, "get_%s_url" % field.name, lambda: None)()
    6061        else:
    6162            value = field.flatten_data(follow=None, obj=obj).get(field.name, "")
    62         return str(value)
    6363
     64        if isinstance(value, str):
     65            return value.decode(settings.DEFAULT_CHARSET)
     66        else:
     67            return unicode(value)
     68
    6469    def start_serialization(self):
    6570        """
    6671        Called when serializing of the queryset starts.
Back to Top