# 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.core.serializers.json import DjangoJSONEncoder, DateTimeAwareJSONEncoder
from django.core.serializers.base import DeserializationError
from riv.serializers import base_serializer as base
import json
        super(Serializer, self).end_serialization()
        if not self.finalize:
            return
        json.dump(self.objects, self.stream, cls=DjangoJSONEncoder, **self.options)

    def getvalue(self):
        if callable(getattr(self.stream, 'getvalue', None)):
            return self.stream.getvalue()

class Loader(base.Loader):
    def pre_loading(self):
        if isinstance(self.data, basestring):
            stream = StringIO(self.data)
        else:
            stream = self.data

        try:
            self.objects = json.load(stream)
        except Exception, e:
            raise base.LoadingError(e)

def Deserializer(stream_or_string, **options):
    """
    Deserialize a stream or string of JSON data.
    """
    if isinstance(stream_or_string, basestring):
        stream = StringIO(stream_or_string)
    else:
        stream = stream_or_string
    try:

# 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/json_serializer.py
from StringIO import StringIO
from django.core.serializers.json import DjangoJSONEncoder, DateTimeAwareJSONEncoder
from django.core.serializers.base import DeserializationError
from riv.serializers import base_serializer as base
import json

        super(Serializer, self).end_serialization()
        if not self.finalize:
            return
        json.dump(self.objects, self.stream, cls=DjangoJSONEncoder, **self.options)

    def getvalue(self):
        if callable(getattr(self.stream, 'getvalue', None)):
            return self.stream.getvalue()

class Loader(base.Loader):
    def pre_loading(self):
        if isinstance(self.data, basestring):
            stream = StringIO(self.data)
        else:
            stream = self.data

        try:
            self.objects = json.load(stream)
        except Exception, e:
            raise base.LoadingError(e)

def Deserializer(stream_or_string, **options):
    """
    Deserialize a stream or string of JSON data.
    """
    if isinstance(stream_or_string, basestring):
        stream = StringIO(stream_or_string)
    else:
        stream = stream_or_string
    try:

        for obj in base.Deserializer(json.load(stream), **options):