def parsePackagesInGroupNode( node, comps ): pkgs = getAllPackages( node ) idNodes = getAllIdChildNodes( node ) if len ( idNodes ) == 0: log.print_warn( "no group id found for " + formatList( pkgs ) ) else: groupName = getNodeText( idNodes[0] ) if len( idNodes ) > 1: log.print_warn( "multiple group ids found for " + formatList( pkgs ) ) comps.addPackagesInGroup( groupName, pkgs )
def load_config(): global LOG_LVL_FILE, LOG_LVL_CONSOLE, CNT_WITH_ESC """ load config from config file return True if sucessful, otherwise False """ cf = ConfigParser.ConfigParser() # if conf file doesn't exist, cp default conf there if not path.exists(CONF_FILE): init_config() cf.read(CONF_FILE); #load options here try: lvl_file = cf.get('settings','log.level.file') lvl_console = cf.get('settings','log.level.console') CNT_WITH_ESC = cf.getboolean('settings','content.with.escape') if lvl_file.lower() not in log.LVL_DICT.keys(): log.print_warn("cannot load log.level.file config, use default: %s" % LOG_LVL_FILE) else: LOG_LVL_FILE = lvl_file if lvl_console.lower() not in log.LVL_DICT.keys(): log.print_warn("cannot load log.level.console config, use default: %s" %LOG_LVL_CONSOLE) else: LOG_LVL_CONSOLE = lvl_console except: log.print_warn('Error occured when loading config, using all default values') return False return True;
def findAllGroups( node ): groups = [] for groupNode in getAllGroupChildNodes( node ): idNodes = getAllIdChildNodes( groupNode ) if idNodes == None or len( idNodes ) == 0 : log.print_warn( "no group id found" ) else: groupName = getNodeText( idNodes[0] ) if not groupName in groups: groups.append( groupName ) else: log.print_warn( "duplicated group name found for " + groupName ) if len( idNodes ) > 1: log.print_warn( "multiple group ids found for %s" %(groupName ) ) return groups
def load_config(): global LOG_LVL_FILE, LOG_LVL_CONSOLE, CNT_WITH_ESC """ load config from config file return True if sucessful, otherwise False """ cf = ConfigParser.ConfigParser() # if conf file doesn't exist, cp default conf there if not path.exists(CONF_FILE): init_config() cf.read(CONF_FILE) #load options here try: lvl_file = cf.get('settings', 'log.level.file') lvl_console = cf.get('settings', 'log.level.console') CNT_WITH_ESC = cf.getboolean('settings', 'content.with.escape') if lvl_file.lower() not in log.LVL_DICT.keys(): log.print_warn( "cannot load log.level.file config, use default: %s" % LOG_LVL_FILE) else: LOG_LVL_FILE = lvl_file if lvl_console.lower() not in log.LVL_DICT.keys(): log.print_warn( "cannot load log.level.console config, use default: %s" % LOG_LVL_CONSOLE) else: LOG_LVL_CONSOLE = lvl_console except: log.print_warn( 'Error occured when loading config, using all default values') return False return True