src/callbacks.py: Allow the docstring to be passed to getHelp()

This commit is contained in:
James Vega 2006-08-28 13:13:43 +00:00
parent 4ee1437c40
commit cd2b58a7d5

View File

@ -214,10 +214,13 @@ def error(msg, s, **kwargs):
msg.tag('isError') msg.tag('isError')
return reply(msg, s, **kwargs) return reply(msg, s, **kwargs)
def getHelp(method, name=None): def getHelp(method, name=None, doc=None):
if name is None: if name is None:
name = method.__name__ name = method.__name__
doclines = method.__doc__.splitlines() if doc is None:
doclines = method.__doc__.splitlines()
else:
doclines = doc.splitlines()
s = '%s %s' % (name, doclines.pop(0)) s = '%s %s' % (name, doclines.pop(0))
if doclines: if doclines:
help = ' '.join(doclines) help = ' '.join(doclines)