Skip to content
Snippets Groups Projects
Commit 808cdaec authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Python3 compatibility - iterator/sequence context, less unicode (thx to Radko Krkos)

parent 95b418a3
No related branches found
No related tags found
No related merge requests found
......@@ -532,7 +532,7 @@ class Client(object):
""" Send out "events" list to server, retrying on server errors.
"""
ev = events
idx_xlat = range(len(ev))
idx_xlat = list(range(len(ev)))
err = Error()
retry = retry or self.retry
attempt = retry
......@@ -550,7 +550,7 @@ class Client(object):
res.errors.sort(key=itemgetter("error"))
for e in res.errors:
errno = e["error"]
evlist = e.get("events", range(len(ev))) # none means all
evlist = e.get("events", list(range(len(ev)))) # none means all
if errno < 500 or not attempt:
# Fatal error or last try, translate indices
# to original and prepare for returning to caller
......
......@@ -56,7 +56,7 @@ def gen_random_idea(client_name="cz.example.warden.test"):
def randip6():
return [rand6ip, geniprange(rand6ip), rand6cidr][randint(0, 2)]()
def randstr(charlist=string.letters, maxlen=32, minlen=1):
def randstr(charlist=string.ascii_letters, maxlen=32, minlen=1):
return ''.join(choice(charlist) for i in range(randint(minlen, maxlen)))
event = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment