From c3736cb96703cbc7b7b4e7b5494dab8ab29a11a6 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 16 Jul 2013 09:45:19 +0000 Subject: [PATCH] WebDoc: Add plugin description and fix crash if a command has no description (as Factoids.learn). --- WebDoc/plugin.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/WebDoc/plugin.py b/WebDoc/plugin.py index a7fb6f75..4d74c3fb 100644 --- a/WebDoc/plugin.py +++ b/WebDoc/plugin.py @@ -71,6 +71,8 @@

%(plugin)s

+

%(description)s

+ @@ -112,12 +114,18 @@ def doGet(self, handler, path): response = 200 callback = cbs[name] commands = callback.listCommands() + description = callback.__doc__ + if not description or description.startswith('Add the help for'): + description = '' if commands: commands.sort() def formatter(command): command = list(map(callbacks.canonicalName, command.split(' '))) doc = callback.getCommandMethod(command).__doc__ + if not doc: + return '' % \ + ' '.join(command) doclines = doc.splitlines() s = cgi.escape('%s %s' % (name, doclines.pop(0))) if doclines: @@ -131,6 +139,7 @@ def formatter(command): output = httpserver.get_template('webdoc/plugin.html') % { 'plugin': name, 'table': table, + 'description': description } self.send_response(response)
Command
%s