(self, son, collection)
return transform_dict(SON(son))
Replace DBRefs with embedded documents.
Replace DBRefs with embedded documents.
Replace DBRefs with embedded documents .
def transform_outgoing(self, son, collection):
        """Replace DBRefs with embedded documents.
        """

        def transform_value(value):
            if isinstance(value, DBRef):
                return self.database.dereference(value)
            elif isinstance(value, list):
                return [transform_value(v) for v in value]
            elif isinstance(value, collections.MutableMapping):
                return transform_dict(SON(value))
            return value

        def transform_dict(object):
            for (key, value) in object.items():
                object[key] = transform_value(value)
            return object

        return transform_dict(SON(son))
def transform_outgoing ( self , son , collection ) : def transform_value ( value ) : if isinstance ( value , DBRef ) : return self . database . dereference ( value ) elif isinstance ( value , list ) : return [ transform_value ( v ) for v in value ] elif isinstance ( value , collections . MutableMapping ) : return transform_dict ( SON ( value ) ) return value def transform_dict ( object ) : for ( key , value ) in object . items ( ) : object [ key ] = transform_value ( value ) return object return transform_dict ( SON ( son ) )