From 80d608eb53c8acc9763b9b90068aa33489326df9 Mon Sep 17 00:00:00 2001 From: Jonas Havelka Date: Thu, 3 Sep 2020 16:07:52 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20o=C5=A1et=C5=99en=C3=AD=20pr=C3=A1zdn?= =?UTF-8?q?=C3=A9ho=20seznamu=20a=20chybn=C3=A9ho=20logov=C3=A1n=C3=AD=20r?= =?UTF-8?q?egistrace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit = pád webu = nemožnost registrace --- seminar/views/views_all.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index 242c4962..0144854a 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -992,6 +992,8 @@ def soustredeniUcastniciExportView(request,soustredeni): def group_by_rocnik(clanky): ''' Vezme zadaný seznam článků a seskupí je podle ročníku. Vrátí seznam seznamů článků ze stejného ročníku.''' + if len(clanky) == 0: + return clanky clanky.order_by('cislo__rocnik__rocnik') skupiny_clanku = [] skupina = [] @@ -1131,7 +1133,7 @@ def logoutView(request): def prihlaska_log_gdpr_safe(logger, gdpr_logger, msg, form_data): - msg = "{}, form_hash:{}".format(msg,hash(form_data)) + msg = "{}, form_hash:{}".format(msg,hash(frozenset(form_data.items))) logger.warn(msg) gdpr_logger.warn(msg+", form:{}".format(form_data)) @@ -1199,8 +1201,8 @@ def prihlaskaView(request): if form.is_valid(): generic_logger.info("Form valid") fcd = form.cleaned_data - form_hash = hash(fcd) - form_logger.info(fcd,form_hash=form_hash) + form_hash = hash(frozenset(fcd.items())) + form_logger.info(fcd,form_hash) # TODO takhle log nefunguje, ale ta předchozí varianta dokonce padala with transaction.atomic(): u = User.objects.create_user( @@ -1230,7 +1232,7 @@ def prihlaskaView(request): else: # Unknown country - log it msg = "Unknown country {}".format(fcd['stat_text']) - err_logger.warn(msg,form_hash=form_hash) + err_logger.warn(msg,form_hash) # TODO viz výše o.save() o.user = u @@ -1248,7 +1250,7 @@ def prihlaskaView(request): else: # Unknown school - log it msg = "Unknown school {}, {}".format(fcd['skola_nazev'],fcd['skola_adresa']) - err_logger.warn(msg,form_hash=form_hash) + err_logger.warn(msg,form_hash) # TODO viz výše r.save()