mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Added a repr keyword argument to errorInvalid and used it to fix bug #1030474.
This commit is contained in:
parent
b898142039
commit
16b9fb386e
@ -144,7 +144,7 @@ def makeNewAlias(name, alias):
|
||||
everythingReplace(tokens)
|
||||
Owner = irc.getCallback('Owner')
|
||||
self.Proxy(irc.irc, msg, tokens)
|
||||
doc ='<an alias, %s>\n\nAlias for %r' % \
|
||||
doc ='<an alias, %s>\n\nAlias for <<%s>>' % \
|
||||
(utils.nItems('argument', biggestDollar), alias)
|
||||
f = utils.changeFunctionName(f, name, doc)
|
||||
return f
|
||||
|
@ -108,7 +108,7 @@ class Misc(callbacks.Privmsg):
|
||||
channel = msg.args[0]
|
||||
if conf.get(conf.supybot.reply.whenNotCommand, channel):
|
||||
command = tokens and tokens[0] or ''
|
||||
irc.errorInvalid('command', command)
|
||||
irc.errorInvalid('command', command, repr=False)
|
||||
else:
|
||||
if tokens:
|
||||
# echo [] will get us an empty token set, but there's no need
|
||||
|
@ -479,13 +479,18 @@ class RichReplyMethods(object):
|
||||
v = self._getConfig(conf.supybot.replies.requiresPrivacy)
|
||||
self._error(self.__makeReply(v, s), **kwargs)
|
||||
|
||||
def errorInvalid(self, what, given=None, s='', **kwargs):
|
||||
def errorInvalid(self, what, given=None, s='', repr=True, **kwargs):
|
||||
if given is not None:
|
||||
v = '%r is not a valid %s.' % (given, what)
|
||||
if repr:
|
||||
given = _repr(given)
|
||||
else:
|
||||
given = '"%s"' % given
|
||||
v = '%s is not a valid %s.' % (given, what)
|
||||
else:
|
||||
v = 'That\'s not a valid %s.' % what
|
||||
self._error(self.__makeReply(v, s), **kwargs)
|
||||
|
||||
_repr = repr
|
||||
|
||||
class IrcObjectProxy(RichReplyMethods):
|
||||
"A proxy object to allow proper nested of commands (even threaded ones)."
|
||||
|
Loading…
Reference in New Issue
Block a user