def get_config_array(self, tool_node, key, defaultValue): '''转换 1,2,4字符类型为list ''' try: getList = lptxml.get_tool_parameter(tool_node, key) lptlog.debug('获取 %s :%s' % (key, getList)) if getList is None: getList = defaultValue getList = utils.check_int_list(getList) except Exception: lptlog.warning('获取 %s error,将采用默认值' % key) getList = defaultValue finally: if not isinstance(getList, list): raise TypeError(getList) return getList
def get_config_array(self, tool_node, key, defaultValue): """转换 1,2,4字符类型为list """ try: getList = lptxml.get_tool_parameter(tool_node, key) lptlog.debug("获取 %s :%s" % (key, getList)) if getList is None: getList = defaultValue getList = utils.check_int_list(getList) except Exception: lptlog.warning("获取 %s error,将采用默认值" % key) getList = defaultValue finally: if not isinstance(getList, list): raise TypeError, getList return getList
def get_config_value(self, tool_node, key, defaultValue, valueType=str): '''从parameters.conf文件中读取Value, 如果读取失败,赋予key, defaultValue ''' try: getValue = lptxml.get_tool_parameter(tool_node, key) lptlog.debug('获取 %s : %s' % (key, getValue)) if getValue is None: getValue = defaultValue except Exception: lptlog.warning("获取 %s error,将采用默认值: %s" %(key, defaultValue)) getValue = defaultValue finally: try: getValue = valueType(getValue) except Exception: raise FormatterError(getValue) return getValue
def get_config_value(self, tool_node, key, defaultValue, valueType=str): """从parameters.conf文件中读取Value, 如果读取失败,赋予key, defaultValue """ try: getValue = lptxml.get_tool_parameter(tool_node, key) lptlog.debug("获取 %s : %s" % (key, getValue)) if getValue is None: getValue = defaultValue except Exception: lptlog.warning("获取 %s error,将采用默认值: %s" % (key, defaultValue)) getValue = defaultValue finally: try: getValue = valueType(getValue) except Exception: raise FormatterError, getValue return getValue