Don't use random.choices (new with python 3.6)

Poor Debian users.
This commit is contained in:
Théophile Bastian 2017-10-16 17:23:56 +02:00
parent 87071ef526
commit 6892b04742

View file

@ -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):