def _save_languages(self, file_path): dirname = os.path.dirname(file_path) if not (os.path.exists(dirname) and os.path.isdir(dirname)): os.mkdir(dirname) serialized = serializer.serialize(self.languages) save_file = open(file_path, 'w') save_file.write(serialized) save_file.close()
def save(self, save_file_path): if not self.changed: return True dirname = os.path.dirname(save_file_path) if not (os.path.exists(dirname) and os.path.isdir(dirname)): os.mkdir(dirname) serialized = serializer.serialize(self.series_list) save_file_path_tmp = save_file_path + ".tmp" save_file = open(save_file_path_tmp, 'w') save_file.write(serialized) save_file.close() os.rename(save_file_path_tmp, save_file_path) self.changed = False return True