def _deserialize(cls, data): if issubclass(cls, models.LogBook): return cls.from_dict(data, unmarshal_time=True) elif issubclass(cls, models.FlowDetail): return cls.from_dict(data) elif issubclass(cls, models.AtomDetail): atom_class = models.atom_detail_class(data['type']) return atom_class.from_dict(data['atom']) else: raise exc.StorageFailure("Invalid storage class %s" % cls)
def convert_atom_detail(row): row = dict(row.items()) atom_cls = models.atom_detail_class(row.pop('atom_type')) return atom_cls.from_dict(row)