From b9e611fd91e391d82f8b8499870c21693296c6af Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 2 Feb 2004 08:33:03 +0000 Subject: [PATCH] Allow an implicit supybot. --- src/Config.py | 10 ++++++++++ test/test_Config.py | 1 + 2 files changed, 11 insertions(+) diff --git a/src/Config.py b/src/Config.py index d957bbd1e..c229b127b 100644 --- a/src/Config.py +++ b/src/Config.py @@ -87,6 +87,11 @@ class Config(callbacks.Privmsg): except registry.InvalidRegistryValue, e: irc.error(str(e)) + def _canonicalizeName(self, name): + if not name.startswith('supybot.'): + name = 'supybot.' + name + return name + def list(self, irc, msg, args): """[--groups] @@ -100,6 +105,7 @@ class Config(callbacks.Privmsg): if name == '--groups': groups = True name = privmsgs.getArgs(rest) + name = self._canonicalizeName(name) group = getWrapper(name) if groups: L = group.children.keys() @@ -151,6 +157,7 @@ class Config(callbacks.Privmsg): Shows the current value of the configuration variable . """ name = privmsgs.getArgs(args) + name = self._canonicalizeName(name) wrapper = getWrapper(name) if wrapper.__class__ is registry.Group: irc.error(msg, 'That\'s not a value, it\'s a group. Use the list ' @@ -165,6 +172,7 @@ class Config(callbacks.Privmsg): Sets the current value of the configuration variable to . """ (name, value) = privmsgs.getArgs(args, required=2) + name = self._canonicalizeName(name) capability = getCapability(name) if ircdb.checkCapability(msg.prefix, capability): wrapper = getWrapper(name) @@ -179,6 +187,7 @@ class Config(callbacks.Privmsg): Returns the description of the configuration variable . """ name = privmsgs.getArgs(args) + name = self._canonicalizeName(name) wrapper = getWrapper(name) if wrapper.help: irc.reply(wrapper.help) @@ -191,6 +200,7 @@ class Config(callbacks.Privmsg): Returns the default value of the configuration variable . """ name = privmsgs.getArgs(args) + name = self._canonicalizeName(name) wrapper = getWrapper(name) irc.reply(wrapper.default) diff --git a/test/test_Config.py b/test/test_Config.py index eccf4a943..f76bbe132 100644 --- a/test/test_Config.py +++ b/test/test_Config.py @@ -50,6 +50,7 @@ class ConfigTestCase(ChannelPluginTestCase): self.assertError('config help supybot.plugins') self.assertError('config help supybot.alsdkfj') self.assertNotError('config help supybot.replies.success') + self.assertNotError('config help replies.success') def testHelpDoesNotAssertionError(self): self.assertNotRegexp('config help ' # Cont'd.