# Path: riv/serializers/base_serializer.py
# SEPARATOR = '__'
# class LoadingError(Exception):
# class Serializer(python.Serializer):
# class Loader:
#     def get_loader(self):
#     def serialize(self, queryset, **options):
#     def fake_serialize(self, queryset, **options):
#     def start_serialization(self):
#     def start_object(self, obj):
#     def end_object(self, obj):
#     def end_serialization(self):
#     def handle_fk_field(self, obj, field):
#     def handle_m2m_field(self, obj, field):
#     def serialize_reverse_fields(self, obj):
#     def _get_serialize_options_for_subfield(self, name):
#     def _map_field(self, key, value):
# def Deserializer(object_list, **options):
#     def load(self, queryset, **options):
#     def pre_loading(self):
#     def post_loading(self):
#     def get_querydict(self, force_batch=False):
#     def get_objects(self):
#     def dictionize_list_for_formsets(self):
#     def remove_excluded_fields(self):
#     def reverse_map_fields(self, objects=None):
#     def rearrange_for_deserialization(self):


from StringIO import StringIO
from django.conf import settings
from django.utils.encoding import smart_str
from django.core.serializers.base import DeserializationError
from django.utils.xmlutils import SimplerXMLGenerator
from xml.dom.minidom import parse
from riv.serializers import base_serializer as base
            if isinstance(self._current[fieldname], list):
                self._current[fieldname].insert(0, smart_str(related.model._meta.verbose_name))

    def end_serialization(self):
        super(Serializer, self).end_serialization()
        if not self.finalize:
            return
        self.xml = SimplerXMLGenerator(self.stream, self.encoding)
        self.xml.startDocument()
        self.xml.startElement(self.ROOT_ELEMENT, {})

        if not isinstance(self.objects, list):
            self.objects = [self.objects,]

        for object in self.objects:
            self.indent(1)
            name = self._get_xml_name(object)
            self.xml.startElement(name, {})
            self.handle_dict(object)
            self.xml.endElement(name)

        self.indent(0)
        self.xml.endElement(self.ROOT_ELEMENT)
        self.xml.endDocument()

    def handle_dict(self, d):
        # Make sure this key is removed.
        if d.has_key('xml_verbose_name'):
            del d['xml_verbose_name']
        for k,v in d.items():

# Path: riv/serializers/base_serializer.py
# SEPARATOR = '__'
# class LoadingError(Exception):
# class Serializer(python.Serializer):
# class Loader:
#     def get_loader(self):
#     def serialize(self, queryset, **options):
#     def fake_serialize(self, queryset, **options):
#     def start_serialization(self):
#     def start_object(self, obj):
#     def end_object(self, obj):
#     def end_serialization(self):
#     def handle_fk_field(self, obj, field):
#     def handle_m2m_field(self, obj, field):
#     def serialize_reverse_fields(self, obj):
#     def _get_serialize_options_for_subfield(self, name):
#     def _map_field(self, key, value):
# def Deserializer(object_list, **options):
#     def load(self, queryset, **options):
#     def pre_loading(self):
#     def post_loading(self):
#     def get_querydict(self, force_batch=False):
#     def get_objects(self):
#     def dictionize_list_for_formsets(self):
#     def remove_excluded_fields(self):
#     def reverse_map_fields(self, objects=None):
#     def rearrange_for_deserialization(self):


# Path: riv/serializers/xml_serializer.py
from StringIO import StringIO
from django.conf import settings
from django.utils.encoding import smart_str
from django.core.serializers.base import DeserializationError
from django.utils.xmlutils import SimplerXMLGenerator
from xml.dom.minidom import parse
from riv.serializers import base_serializer as base

            if isinstance(self._current[fieldname], list):
                self._current[fieldname].insert(0, smart_str(related.model._meta.verbose_name))

    def end_serialization(self):
        super(Serializer, self).end_serialization()
        if not self.finalize:
            return
        self.xml = SimplerXMLGenerator(self.stream, self.encoding)
        self.xml.startDocument()
        self.xml.startElement(self.ROOT_ELEMENT, {})

        if not isinstance(self.objects, list):
            self.objects = [self.objects,]

        for object in self.objects:
            self.indent(1)
            name = self._get_xml_name(object)
            self.xml.startElement(name, {})
            self.handle_dict(object)
            self.xml.endElement(name)

        self.indent(0)
        self.xml.endElement(self.ROOT_ELEMENT)
        self.xml.endDocument()

    def handle_dict(self, d):
        # Make sure this key is removed.
        if d.has_key('xml_verbose_name'):
            del d['xml_verbose_name']
        for k,v in d.items():

            self.indent(2)