def save(self, fileName=None): """Save all settings to the appropriate file. @param fileName: what file to save to. If None, save to the last file that we loaded/saved from @type fileName: file or None""" if not fileName: fileName = self.fileName assert fileName != None, "Must set the Settings object filename before calling save, or pass it a file!" SettingsFile.pickle(self, fileName)
def load(self, fileName): """Create a Settings object by loading a file. @param fileName: what file to load the settings from. @type fileName: file @returns: True if file loaded properly, False otherwise""" # check that the file exists if not os.path.exists(fileName) or not os.path.isfile(fileName): log_msg("Could not load settings file because it does not exist: %s" % (fileName), 1) return False SettingsFile.unpickle(self, fileName) return True
def load(self, fileName): """Create a Settings object by loading a file. @param fileName: what file to load the settings from. @type fileName: file @returns: True if file loaded properly, False otherwise""" #check that the file exists if not os.path.exists(fileName) or not os.path.isfile(fileName): log_msg( "Could not load settings file because it does not exist: %s" % (fileName), 1) return False SettingsFile.unpickle(self, fileName) return True