Пример #1
0
    def config_to_str(self, config, serialize_type=TYPE_JSON):
        transform = self.get_str_transform(serialize_type)
        if transform is not None:
            return transform.transform(
                ConfigSerialize(config.__class__).serialize(config))

        raise ValueError("unrecognized serialize_type=%d" % serialize_type)
Пример #2
0
 def load_data(self, datadict):
     logger.debug("Loading config")
     return ConfigSerialize(Config).deserialize(datadict)
Пример #3
0
 def __str__(self):
     from yowsup.config.v1.serialize import ConfigSerialize
     from yowsup.config.transforms.dict_json import DictJsonTransform
     return DictJsonTransform().transform(ConfigSerialize(self.__class__).serialize(self))