Exemple #1
0
 def rename(self, current_profile_name, new_profile_name):
     '''
     Renames a profile 'current_profile_name' to a new name 'new_profile_name'
     '''
     if not current_profile_name in self.index:
         raise Exception("Cannot rename: " + current_profile_name + " does not exist")
     if new_profile_name in self.index:
         raise Exception("Cannot rename: " + new_profile_name + " already exists")
     FileTools.rename(str(self.BASE_PATH.joinpath(*self.index[current_profile_name]["directory"])), str(self.BASE_PATH.joinpath(FileTools.create_valid_name(new_profile_name))))
     del self.index[current_profile_name]
     self.index[new_profile_name] = dict()
     self.index[new_profile_name]["directory"] = [FileTools.create_valid_name(new_profile_name)]
     self._flush_index()