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,18 +1,16 @@
|
||||||
#!/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
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, version 3 of the License.
|
# the Free Software Foundation, version 3 of the License.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
@ -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