Mercurial > moin > 1.9
changeset 2167:37e16cdc3a84
Make the output of GetPageInfo command human-readable
author | Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl> |
---|---|
date | Mon, 18 Jun 2007 17:27:30 +0200 |
parents | 2a7b535b1e44 |
children | f10336f74a6e |
files | jabberbot/xmlrpcbot.py jabberbot/xmppbot.py |
diffstat | 2 files changed, 24 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/jabberbot/xmlrpcbot.py Mon Jun 18 16:36:03 2007 +0200 +++ b/jabberbot/xmlrpcbot.py Mon Jun 18 17:27:30 2007 +0200 @@ -8,6 +8,7 @@ import Queue import time, xmlrpclib +import datetime from threading import Thread from SimpleXMLRPCServer import SimpleXMLRPCServer @@ -161,7 +162,28 @@ token_result, getpageinfo_result = self.multicall() # FIXME: warn if token turned out being wrong - command.data = getpageinfo_result[0] + + author = getpageinfo_result[0]['author'] + if author.startswith("Self:"): + author = getpageinfo_result[0]['author'][5:] + + datestr = str(getpageinfo_result[0]['lastModified']) + date = u"%(year)s-%(month)s-%(day)s at %(time)s" % { + 'year': datestr[:4], + 'month': datestr[4:6], + 'day': datestr[6:8], + 'time': datestr[9:17], + } + + msg = u"""Last author: %(author)s +Last modification: %(modification)s +Current version: %(version)s""" % { + 'author': author, + 'modification': date, + 'version': getpageinfo_result[0]['version'], + } + + command.data = msg get_page_info = _xmlrpc_decorator(get_page_info)
--- a/jabberbot/xmppbot.py Mon Jun 18 16:36:03 2007 +0200 +++ b/jabberbot/xmppbot.py Mon Jun 18 17:27:30 2007 +0200 @@ -215,7 +215,7 @@ self.send_message(command.jid, msg % (pagelist, )) elif isinstance(command, cmd.GetPageInfo): - msg = u"""Here's some more detailed information on page "%s":\n\n%s""" + msg = u"""Following detailed information on page "%s" is available::\n\n%s""" self.send_message(command.jid, msg % (command.pagename, command.data)) def ask_for_subscription(self, jid):