dispatch/api/serializers.py
def insert_instance(self, block):
        """Insert a fetched instance into embed block."""

        embed_type = block.get('type', None)
        data = block.get('data', {})
        serializer = self.serializers.get(embed_type, None)

        if serializer is None:
            return block

        try:
            instance_id = serializer.get_id(data)
            instance = self.instances[embed_type][instance_id]
            data[embed_type] = serializer.serialize(instance)
        except:
            data[embed_type] = None

        block['data'] = data

        return block
def insert_instance(self, block):
        embed_type = block.get('type', None)
        data = block.get('data', {})
        serializer = self.serializers.get(embed_type, None)

        if serializer is None:
            return block

        try:
            instance_id = serializer.get_id(data)
            instance = self.instances[embed_type][instance_id]
            data[embed_type] = serializer.serialize(instance)
        except:
            data[embed_type] = None

        block['data'] = data

        return block
def insert_instance ( self , block ) : embed_type = block . get ( 'type' , None ) data = block . get ( 'data' , { } ) serializer = self . serializers . get ( embed_type , None ) if serializer is None : return block try : instance_id = serializer . get_id ( data ) instance = self . instances [ embed_type ] [ instance_id ] data [ embed_type ] = serializer . serialize ( instance ) except : data [ embed_type ] = None block [ 'data' ] = data return block
Insert a fetched instance into embed block.
Insert a fetched instance into embed block .