Ticket #4227: core_serializers.diff
File core_serializers.diff, 1.5 KB (added by , 18 years ago) |
---|
-
xml_serializer.py
68 68 # serializer base class). 69 69 if getattr(obj, field.name) is not None: 70 70 value = self.get_string_value(obj, field) 71 self.xml.characters( str(value))71 self.xml.characters(value) 72 72 else: 73 73 self.xml.addQuickElement("None") 74 74 … … 226 226 inner_text.extend(getInnerText(child)) 227 227 else: 228 228 pass 229 return "".join(inner_text) 230 No newline at end of file 229 return "".join(inner_text) -
base.py
7 7 except ImportError: 8 8 from StringIO import StringIO 9 9 from django.db import models 10 from django.conf import settings 10 11 11 12 class SerializationError(Exception): 12 13 """Something bad happened during serialization.""" … … 59 60 value = getattr(obj, "get_%s_url" % field.name, lambda: None)() 60 61 else: 61 62 value = field.flatten_data(follow=None, obj=obj).get(field.name, "") 62 return str(value)63 63 64 if isinstance(value, str): 65 return value.decode(settings.DEFAULT_CHARSET) 66 else: 67 return unicode(value) 68 64 69 def start_serialization(self): 65 70 """ 66 71 Called when serializing of the queryset starts.