Commit 1004f75a authored by Flavio TARSETTI's avatar Flavio TARSETTI

[accounts][models/management-commands] Fixed typos

parent edcb7941
Pipeline #39860 passed with stage
in 14 minutes and 55 seconds
......@@ -59,7 +59,7 @@ class Command(BaseCommand):
temporary_urls_count = TemporaryUrl.objects.all().count()
now = datetime.datetime.now()
count = TemporaryUrl.objects.filter(expires__lt=now).delete()[0]
count, _ = TemporaryUrl.objects.filter(expires__lt=now).delete()
self.stdout.write('{} Expired temporary url(s) successfully cleaned/'.format(count) + '{} Total temporary url(s) checked'.format(temporary_urls_count))
......
......@@ -35,6 +35,12 @@ import random
import string
import datetime
# ------------------------------------------------------------------------------
# Constants
TEMPORARY_URL_LENGTH = 32
# ------------------------------------------------------------------------------
class AccountSettingsManager(models.Manager):
def get_by_natural_key(self, owner):
......@@ -158,10 +164,9 @@ class TemporaryUrlManager(models.Manager):
# Actions that result creating the object
# url_hash creation
length = 32
url_hash = "".join(
random.choice(string.ascii_letters + string.digits) # nosec
for _ in range(length)
for _ in range(TEMPORARY_URL_LENGTH)
)
now = datetime.datetime.now()
expiration_date_delta = datetime.timedelta(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment