当前位置: 首页>>代码示例>>Python>>正文


Python Election.read_ipaddr_value方法代码示例

本文整理汇总了Python中election.Election.read_ipaddr_value方法的典型用法代码示例。如果您正苦于以下问题:Python Election.read_ipaddr_value方法的具体用法?Python Election.read_ipaddr_value怎么用?Python Election.read_ipaddr_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在election.Election的用法示例。


在下文中一共展示了Election.read_ipaddr_value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_set_hts_conf

# 需要导入模块: from election import Election [as 别名]
# 或者: from election.Election import read_ipaddr_value [as 别名]
def do_set_hts_conf():

    reg = Election().get_root_reg()
    if reg.check(['common', 'htsip']):
        try:
            def_ip_port = reg.read_ipaddr_value(\
                                        ['common'], 'htsip').value.split(":")
            def_ip = def_ip_port[0]
            if len(def_ip_port) > 1:
                try:
                    def_port = int(def_ip_port[-1])
                except ValueError:
                    def_port = 80
            else:
                def_port = 80
        except:
            def_ip = None
            def_port = 80
    else:
        def_ip = None
        def_port = 80

    hts_ip = uiutil.ask_string("Sisesta HTSi IP aadress", None, None, def_ip)
    hts_port = uiutil.ask_int("Sisesta HTSi port", def_port, 0, 65535)

    if reg.check(['common', 'htspath']):
        try:
            def_url = reg.read_string_value(['common'], 'htspath').value
        except:
            def_url = None
    else:
        def_url = None
    hts_url = uiutil.ask_string("Sisesta HTSi URL", None, None, def_url)

    try:
        def_verify = Election().get_hts_verify_path()
    except:
        def_verify = None
    hts_verify = uiutil.ask_string("Sisesta HTSi hääle kontrolli URL", \
            None, None, def_verify)

    cmd = "%s set %s:%d %s %s" % (SCRIPT_CONFIG_HTH, hts_ip, hts_port, \
            hts_url, hts_verify)
    os.system(cmd)
开发者ID:IGBAnet,项目名称:evalimine,代码行数:46,代码来源:serviceutil.py

示例2: do_set_hts_conf

# 需要导入模块: from election import Election [as 别名]
# 或者: from election.Election import read_ipaddr_value [as 别名]
def do_set_hts_conf():

    reg = Election().get_root_reg()
    if reg.check(['common', 'htsip']):
        try:
            def_ip_port = reg.read_ipaddr_value(
                ['common'], 'htsip').value.split(":")
            def_ip = def_ip_port[0]
            if len(def_ip_port) > 1:
                try:
                    def_port = int(def_ip_port[-1])
                except ValueError:
                    def_port = 80
            else:
                def_port = 80
        except:
            def_ip = None
            def_port = 80
    else:
        def_ip = None
        def_port = 80

    hts_ip = uiutil.ask_string("Sisesta HTSi IP aadress", None, None, def_ip)
    hts_port = uiutil.ask_int("Sisesta HTSi port", def_port, 0, 65535)

    try:
        def_url = Election().get_hts_path()
    except:
        def_url = "/hts.cgi"
    hts_url = uiutil.ask_string("Sisesta HTSi URL", None, None, def_url)

    try:
        def_verify = Election().get_hts_verify_path()
    except:
        def_verify = "/hts-verify-vote.cgi"
    hts_verify = uiutil.ask_string(
        "Sisesta HTSi hääle kontrolli URL", None, None, def_verify)

    subprocess.call([SCRIPT_CONFIG_HTH, "%s:%d" %
                     (hts_ip, hts_port), hts_url, hts_verify])
开发者ID:Augustyn,项目名称:evalimine,代码行数:42,代码来源:serviceutil.py


注:本文中的election.Election.read_ipaddr_value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。