def commit(self): if hasattr(self, 'file_path') and self.file_path: if not os.path.exists(self.file_path): make_config_dir() with ExclusiveFile(self.file_path) as f: raw = cPickle.dumps(self, -1) f.seek(0) f.truncate() f.write(raw)
def commit(self): if not getattr(self, 'name', None): return if not os.path.exists(self.file_path): make_config_dir() raw = json_dumps(self) with ExclusiveFile(self.file_path) as f: f.seek(0) f.truncate() f.write(raw)