fix horrible mistakes

This commit is contained in:
Jeremy McMillan 2019-01-03 22:53:02 -06:00 committed by Pedro Algarvio
parent c092baf9da
commit 15c6deba62

View File

@ -1956,11 +1956,14 @@ def parse_host_port(host_port):
host = ipaddress.ipv6IPv6Address(host) host = ipaddress.ipv6IPv6Address(host)
else: else:
if _s_.count(":") == 1: if _s_.count(":") == 1:
host, _hostport_separator_, port = _s_.parttion(":") host, _hostport_separator_, port = _s_.partition(":")
if port: try:
port = int(port) port = int(port)
if port and ":" in port: except ValueError as _e_:
raise ValueError('too many ":" separators in host:port "{}"'.format(host_port)) log.error('host_port "%s" port value "%s" is not an integer.', host_port, port)
raise _e_
else:
host = _s_
try: try:
host_ip = ipaddress.ip_address(host) host_ip = ipaddress.ip_address(host)
host = host_ip host = host_ip