def reread(self, reread_global = True): """ Unconditionally reread the config file. """ if reread_global: self.gconfig.reread() BaseConfig.reread(self) self.copyVarsFromGlobal() self.mungeVars()
def rereadIfUpdated(self): """ Reread the config file if it or the global config file has updated (later modification time than last read) """ if self.gconfig.rereadIfUpdated(): # global config has changed - need to remake regardless self.reread(reread_global = False) return True else: return BaseConfig.rereadIfUpdated(self)
def __init__(self): CmdParams.__init__(self) BaseConfig.__init__(self, self.config_path) self.__current_document = None self.__no_doc = { '1': ('Create nakladnaya', self.create_nakl), '7': ('Load document', self.load_current_doc), '8': ('Create Invoice', self.create_invoice) } self.__with_nakladnaya = { '2': ('Add position in nakladnay', self.add_pos_in_nakl), '3': ('Show document', self.current_doc_show), '4': ('Change number of document', self.number_change), '5': ('Save document', self.save_current_doc), '6': ('Delete document', self.delete_current_doc), '9': ('Enter delivery address', self.set_address) } self.__with_invoice = { '3': ('Show document', self.current_doc_show), '4': ('Change number of document', self.number_change), '5': ('Save document', self.save_current_doc), '6': ('Delete document', self.delete_current_doc) }
def __init__(self): BaseConfig.__init__(self)
def __init__(self, dataset_name, gconfig, global_path = None, **kwargs): # allow a filename for gconfig if isinstance(gconfig, str): gconfig = GlobalConfig.GlobalConfig(gconfig) if gconfig["global"].has_key("dataset_config_dir"): gconfig["global"]["config_dir"] = gconfig["global"]["dataset_config_dir"] print "Re-setting '%s' to use configs in alternative dir: %s" % (dataset_name, gconfig["global"]["config_dir"]) if global_path == None: file_path = os.path.join(gconfig["global"]["config_dir"], "ds_%s.ini" % dataset_name) else: file_path = global_path self.name = dataset_name self.gconfig = gconfig BaseConfig.__init__(self, file_path, **kwargs)