Ensure that unnecessary tg messages will not crash anything useful

This commit is contained in:
okalintu
2019-02-08 18:31:45 +02:00
parent 8a8751ce66
commit dce19b8d38
+10 -6
View File
@@ -50,12 +50,16 @@ def ohlhafv_submit(request, *args, **kwargs):
)
send_email(email, subject, message)
tg_message = render_to_string(
'ohlhafv:tgmsg.tpl', {
'challenge': challenge,
'url': url})
bot = TelegramBot()
bot.broadcast(tg_message)
try:
tg_message = render_to_string(
'ohlhafv:tgmsg.tpl', {
'challenge': challenge,
'url': url})
bot = TelegramBot()
bot.broadcast(tg_message)
except: # tg spam is not critical. Ignore on failure
pass
logging.debug(
'Sent ohlhafv email to recipient <{}>'.format(email))
else: