mirror of https://github.com/Mikaela/Limnoria.git
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)
|
everythingReplace(tokens)
|
||||||
Owner = irc.getCallback('Owner')
|
Owner = irc.getCallback('Owner')
|
||||||
self.Proxy(irc.irc, msg, tokens)
|
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)
|
(utils.nItems('argument', biggestDollar), alias)
|
||||||
f = utils.changeFunctionName(f, name, doc)
|
f = utils.changeFunctionName(f, name, doc)
|
||||||
return f
|
return f
|
||||||
|
|
|
@ -108,7 +108,7 @@ class Misc(callbacks.Privmsg):
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
if conf.get(conf.supybot.reply.whenNotCommand, channel):
|
if conf.get(conf.supybot.reply.whenNotCommand, channel):
|
||||||
command = tokens and tokens[0] or ''
|
command = tokens and tokens[0] or ''
|
||||||
irc.errorInvalid('command', command)
|
irc.errorInvalid('command', command, repr=False)
|
||||||
else:
|
else:
|
||||||
if tokens:
|
if tokens:
|
||||||
# echo [] will get us an empty token set, but there's no need
|
# 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)
|
v = self._getConfig(conf.supybot.replies.requiresPrivacy)
|
||||||
self._error(self.__makeReply(v, s), **kwargs)
|
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:
|
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:
|
else:
|
||||||
v = 'That\'s not a valid %s.' % what
|
v = 'That\'s not a valid %s.' % what
|
||||||
self._error(self.__makeReply(v, s), **kwargs)
|
self._error(self.__makeReply(v, s), **kwargs)
|
||||||
|
|
||||||
|
_repr = repr
|
||||||
|
|
||||||
class IrcObjectProxy(RichReplyMethods):
|
class IrcObjectProxy(RichReplyMethods):
|
||||||
"A proxy object to allow proper nested of commands (even threaded ones)."
|
"A proxy object to allow proper nested of commands (even threaded ones)."
|
||||||
|
|
Loading…
Reference in New Issue