From 6892b04742b72c48540c23e401ef86f7073a2ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Mon, 16 Oct 2017 17:23:56 +0200 Subject: [PATCH] Don't use `random.choices` (new with python 3.6) Poor Debian users. --- api/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/models.py b/api/models.py index 2ea06c5..1ce36ca 100644 --- a/api/models.py +++ b/api/models.py @@ -5,6 +5,7 @@ import hashlib import random import string + class ApiKey(models.Model): ''' An API key, to login using the API @@ -32,7 +33,8 @@ class ApiKey(models.Model): if not self.key: KEY_SIZE = 64 KEY_CHARS = string.ascii_letters + string.digits - self.key = ''.join(random.choices(KEY_CHARS, k=KEY_SIZE)) + self.key = ''.join( + [random.choice(KEY_CHARS) for _ in range(KEY_SIZE)]) @property def keyId(self):