string_Utils.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:warriorframework 作者: warriorframework 项目源码 文件源码
def sub_from_varconfigfile(string, varconfigfile, start_pat="${", end_pat="}"):
    """ """
    try:
        # when varconfigfile is an XMl object(root element) - this happens
        # only when varconfigfile is taken from database server
        if isinstance(varconfigfile, ElementTree.Element) is True:
            cfg_elem_obj = ConfigurationElement("Varconfig_from_database",
                                                start_pat, end_pat)
            cfg_elem_obj.parse_data(varconfigfile, elem_type="xml_object")
        else:
            cfg_elem_obj = ConfigurationElement(varconfigfile, start_pat, end_pat)
            cfg_elem_obj.parse_data(varconfigfile)
        newstring = cfg_elem_obj.expand_variables(string)
    except TypeError as exception:
        print_info("At least one of the variables in command string is not found in  " + varconfigfile)
        #print_exception(exception)
        return False
    return newstring
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号