Python 3 fixes

This commit is contained in:
Sachi King 2017-04-22 18:43:13 +10:00
parent a2464bd95e
commit b156be1e7e
2 changed files with 3 additions and 4 deletions

View file

@ -299,10 +299,9 @@ class ReportView(object):
response = HttpResponse(content_type='text/csv')
writer = csv.writer(response)
encode = lambda i: i.encode("utf8") if isinstance(i, unicode) else i
writer.writerow(list(encode(i) for i in report.headings()))
writer.writerow(report.headings())
for row in report.rows():
writer.writerow(list(encode(i) for i in row))
writer.writerow(row)
return response

View file

@ -12,7 +12,7 @@ def generate_access_code():
length = 6
# all upper-case letters + digits 1-9 (no 0 vs O confusion)
chars = string.uppercase + string.digits[1:]
chars = string.ascii_uppercase + string.digits[1:]
# 6 chars => 35 ** 6 = 1838265625 (should be enough for anyone)
return get_random_string(length=length, allowed_chars=chars)