send a mail when an error occured while posting a message
This commit is contained in:
parent
baa2a7de51
commit
bbca6f3f81
1 changed files with 13 additions and 8 deletions
|
|
@ -1,6 +1,4 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai
|
|
||||||
|
|
||||||
# Copyright(C) 2009-2010 Romain Bignon, Christophe Benz
|
# Copyright(C) 2009-2010 Romain Bignon, Christophe Benz
|
||||||
#
|
#
|
||||||
|
|
@ -27,7 +25,7 @@ import time
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply
|
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
||||||
from weboob.tools.application import ConsoleApplication
|
from weboob.tools.application import ConsoleApplication
|
||||||
from weboob.tools.misc import html2text
|
from weboob.tools.misc import html2text
|
||||||
|
|
||||||
|
|
@ -100,8 +98,15 @@ class Monboob(ConsoleApplication):
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
thread_id, msg_id = id.rsplit('.', 1)
|
thread_id, msg_id = id.rsplit('.', 1)
|
||||||
for m in backend.post_reply(thread_id, msg_id, title, content):
|
try:
|
||||||
self.send_email(backend, m)
|
backend.post_reply(thread_id, msg_id, title, content)
|
||||||
|
except Exception, e:
|
||||||
|
self.send_email(backend, Message(thread_id,
|
||||||
|
0,
|
||||||
|
title='Unable to send message',
|
||||||
|
sender='Monboob',
|
||||||
|
reply_id=msg_id,
|
||||||
|
content='Unable to send message to %s:\n\n\t%s' % (thread_id, e)))
|
||||||
|
|
||||||
@ConsoleApplication.command("run daemon")
|
@ConsoleApplication.command("run daemon")
|
||||||
def command_run(self):
|
def command_run(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue