From ca10d3a9b24c848fe3da26f8cd40d463e9a05f58 Mon Sep 17 00:00:00 2001 From: ninya9k Date: Wed, 26 May 2021 15:17:03 +0000 Subject: [PATCH] fix UnboundLocalError --- website/chat.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/website/chat.py b/website/chat.py index 22a07f7..3a6e447 100644 --- a/website/chat.py +++ b/website/chat.py @@ -59,6 +59,10 @@ def remove_expired_nonces(): def _comment(text, token, c_response, c_ciphertext, nonce): # TODO: if multiple errors, give out the least annoying one, e.g. N_CAPTCHA_MISSING is far more annoying than N_MESSAGE_EMPTY + pprint(viewers) + + now = int(time.time()) + # check captcha if not viewers[token]['verified']: if c_response and c_ciphertext: @@ -86,7 +90,6 @@ def _comment(text, token, c_response, c_ciphertext, nonce): else: return N_CAPTCHA_MISSING - now = int(time.time()) if not token: return N_TOKEN_EMPTY if not text: @@ -106,8 +109,6 @@ def _comment(text, token, c_response, c_ciphertext, nonce): if t < now - FLOOD_PERIOD: viewers[token]['recent_comments'].remove(t) - pprint(viewers) - if viewers[token]['banned']: return N_BANNED