Fix getCommandHelp's use of dynamic.msg

Default chan to None so we can still retrieve a config value if dynamic.msg
isn't valid (e.g., when running supybot-plugin-doc).

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
James Vega 2009-04-28 08:03:21 -04:00
parent cedc4aaebe
commit 0615846ab3
2 changed files with 10 additions and 7 deletions

View File

@ -107,10 +107,12 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler):
def getCommandHelp(self, command):
method = self.getCommandMethod(command)
if method.im_func.func_name == 'learn':
s = self.registryValue('learnSeparator', dynamic.msg.args[0])
chan = None
if dynamic.msg is not None:
chan = dynamic.msg.args[0]
s = self.registryValue('learnSeparator', chan)
help = callbacks.getHelp
if conf.get(conf.supybot.reply.showSimpleSyntax,
dynamic.msg.args[0]):
if conf.get(conf.supybot.reply.showSimpleSyntax, chan):
help = callbacks.getSyntax
return help(method,
doc=method._fake__doc__ % (s, s),

View File

@ -1200,10 +1200,11 @@ class Commands(BasePlugin):
def getCommandHelp(self, command):
method = self.getCommandMethod(command)
help = getHelp
m = dynamic.msg
if m is not None:
if conf.get(conf.supybot.reply.showSimpleSyntax, m.args[0]):
help = getSyntax
chan = None
if dynamic.msg is not None:
chan = dynamic.msg.args[0]
if conf.get(conf.supybot.reply.showSimpleSyntax, chan):
help = getSyntax
if hasattr(method, '__doc__'):
return help(method, name=formatCommand(command))
else: