fix UnboundLocalError

このコミットが含まれているのは:
n9k 2021-05-26 15:17:03 +00:00
コミット ca10d3a9b2
1個のファイルの変更4行の追加3行の削除

ファイルの表示

@ -59,6 +59,10 @@ def remove_expired_nonces():
def _comment(text, token, c_response, c_ciphertext, nonce): 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 # 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 # check captcha
if not viewers[token]['verified']: if not viewers[token]['verified']:
if c_response and c_ciphertext: if c_response and c_ciphertext:
@ -86,7 +90,6 @@ def _comment(text, token, c_response, c_ciphertext, nonce):
else: else:
return N_CAPTCHA_MISSING return N_CAPTCHA_MISSING
now = int(time.time())
if not token: if not token:
return N_TOKEN_EMPTY return N_TOKEN_EMPTY
if not text: if not text:
@ -106,8 +109,6 @@ def _comment(text, token, c_response, c_ciphertext, nonce):
if t < now - FLOOD_PERIOD: if t < now - FLOOD_PERIOD:
viewers[token]['recent_comments'].remove(t) viewers[token]['recent_comments'].remove(t)
pprint(viewers)
if viewers[token]['banned']: if viewers[token]['banned']:
return N_BANNED return N_BANNED