From 4579e72850d86514bfda81f166c58a23b8197682 Mon Sep 17 00:00:00 2001 From: Juke Date: Thu, 10 Mar 2011 01:58:29 +0100 Subject: [PATCH] new xhtml formatter --- weboob/applications/boobmsg/boobmsg.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/weboob/applications/boobmsg/boobmsg.py b/weboob/applications/boobmsg/boobmsg.py index 3ce501e4..20c959c0 100644 --- a/weboob/applications/boobmsg/boobmsg.py +++ b/weboob/applications/boobmsg/boobmsg.py @@ -25,10 +25,26 @@ from weboob.tools.application.repl import ReplApplication from weboob.tools.application.formatters.iformatter import IFormatter from weboob.tools.misc import html2text - __all__ = ['Boobmsg'] +class XHtmlFormatter(IFormatter): + def flush(self): + pass + + def format_dict(self, item): + result = "
\n" + result += "

%s

" % (item['title']) + result += "
" + result += "
Date
%s
" % (item['date']) + result += "
Sender
%s
" % (item['sender']) + result += "
Signature
%s
" % (item['signature']) + result += "
" + result += "
%s
" % (item['content']) + result += "
\n" + return result + + class MessageFormatter(IFormatter): def flush(self): pass @@ -153,6 +169,7 @@ class Boobmsg(ReplApplication): CAPS = ICapMessages EXTRA_FORMATTERS = {'msglist': MessagesListFormatter, 'msg': MessageFormatter, + 'xhtml': XHtmlFormatter, } COMMANDS_FORMATTERS = {'list': 'msglist', 'show': 'msg',