def from_son(self, value): module_name = value.pop('__module__') klass_name = value.pop('__class__') klass = get_class(module_name, klass_name) return klass(**value)
def embedded_type(self): if self._resolved_embedded_type is None: if isinstance(self._embedded_document_type, six.string_types): self._resolved_embedded_type = get_class(self._embedded_document_type) else: self._resolved_embedded_type = self._embedded_document_type return self._resolved_embedded_type
def from_son(cls, dic): klass = get_class(dic.pop('__module__'), dic.pop('__class__')) field_values = {} for name, value in dic.items(): if name in cls._fields: field_values[name] = cls._fields[name].from_son(value) else: field_values[name] = value return klass(**field_values)