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) send_email(email, subject, message)
tg_message = render_to_string( try:
'ohlhafv:tgmsg.tpl', { tg_message = render_to_string(
'challenge': challenge, 'ohlhafv:tgmsg.tpl', {
'url': url}) 'challenge': challenge,
bot = TelegramBot() 'url': url})
bot.broadcast(tg_message) bot = TelegramBot()
bot.broadcast(tg_message)
except: # tg spam is not critical. Ignore on failure
pass
logging.debug( logging.debug(
'Sent ohlhafv email to recipient <{}>'.format(email)) 'Sent ohlhafv email to recipient <{}>'.format(email))
else: else: