From b156be1e7ed458d81589f560d37cdc00064f9b4c Mon Sep 17 00:00:00 2001 From: Sachi King Date: Sat, 22 Apr 2017 18:43:13 +1000 Subject: [PATCH] Python 3 fixes --- registrasion/reporting/reports.py | 5 ++--- registrasion/util.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/registrasion/reporting/reports.py b/registrasion/reporting/reports.py index eabc4250..a9684802 100644 --- a/registrasion/reporting/reports.py +++ b/registrasion/reporting/reports.py @@ -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 diff --git a/registrasion/util.py b/registrasion/util.py index b5fa0620..98079c7e 100644 --- a/registrasion/util.py +++ b/registrasion/util.py @@ -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)