Factoids: Add simpleSyntax argument to getCommandHelp.

It helps to properly override the parent class's method so that Misc.help
doesn't error when trying to get Factoids.learn's help.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
James Vega 2009-05-18 11:09:18 -04:00
parent 9f718fb01c
commit cca36ed9f2

View File

@ -104,7 +104,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler):
db.commit() db.commit()
return db return db
def getCommandHelp(self, command): def getCommandHelp(self, command, simpleSyntax=None):
method = self.getCommandMethod(command) method = self.getCommandMethod(command)
if method.im_func.func_name == 'learn': if method.im_func.func_name == 'learn':
chan = None chan = None
@ -112,12 +112,15 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler):
chan = dynamic.msg.args[0] chan = dynamic.msg.args[0]
s = self.registryValue('learnSeparator', chan) s = self.registryValue('learnSeparator', chan)
help = callbacks.getHelp help = callbacks.getHelp
if conf.get(conf.supybot.reply.showSimpleSyntax, chan): if simpleSyntax is None:
simpleSyntax = conf.get(conf.supybot.reply.showSimpleSyntax,
chan)
if simpleSyntax:
help = callbacks.getSyntax help = callbacks.getSyntax
return help(method, return help(method,
doc=method._fake__doc__ % (s, s), doc=method._fake__doc__ % (s, s),
name=callbacks.formatCommand(command)) name=callbacks.formatCommand(command))
return super(Factoids, self).getCommandHelp(command) return super(Factoids, self).getCommandHelp(command, simpleSyntax)
def learn(self, irc, msg, args, channel, key, factoid): def learn(self, irc, msg, args, channel, key, factoid):
db = self.getDb(channel) db = self.getDb(channel)