updated websockify to be compatible with python3

This commit is contained in:
Radek Podgorny 2014-09-30 12:29:26 +02:00
parent 58529d347b
commit 44b4e29162
1 changed files with 3 additions and 3 deletions

View File

@ -90,7 +90,7 @@ Traffic Legend:
# Extract the token parameter from url # Extract the token parameter from url
args = parse_qs(urlparse(path)[4]) # 4 is the query from url args = parse_qs(urlparse(path)[4]) # 4 is the query from url
if not args.has_key('token') or not len(args['token']): if not 'token' in args or not len(args['token']):
raise self.EClose("Token not present") raise self.EClose("Token not present")
token = args['token'][0].rstrip('\n') token = args['token'][0].rstrip('\n')
@ -105,14 +105,14 @@ Traffic Legend:
targets = {} targets = {}
for f in cfg_files: for f in cfg_files:
for line in [l.strip() for l in file(f).readlines()]: for line in [l.strip() for l in open(f).readlines()]:
if line and not line.startswith('#'): if line and not line.startswith('#'):
ttoken, target = line.split(': ') ttoken, target = line.split(': ')
targets[ttoken] = target.strip() targets[ttoken] = target.strip()
self.vmsg("Target config: %s" % repr(targets)) self.vmsg("Target config: %s" % repr(targets))
if targets.has_key(token): if token in targets:
return targets[token].split(':') return targets[token].split(':')
else: else:
raise self.EClose("Token '%s' not found" % token) raise self.EClose("Token '%s' not found" % token)