In registry.py, test whether a requested configuration variable is a channel name before creating it automatically. Closes GH-63.

This commit is contained in:
Valentin Lorentz 2011-07-06 11:14:58 +02:00
parent 7892df6dad
commit c6facc99f3
3 changed files with 6 additions and 3 deletions

View File

@ -34,7 +34,7 @@ import supybot.conf as conf
class ConfigTestCase(ChannelPluginTestCase): class ConfigTestCase(ChannelPluginTestCase):
# We add utilities so there's something in supybot.plugins. # We add utilities so there's something in supybot.plugins.
plugins = ('Config', 'Utilities') plugins = ('Config', 'Utilities', 'AutoMode')
def testGet(self): def testGet(self):
self.assertNotRegexp('config get supybot.reply', r'registry\.Group') self.assertNotRegexp('config get supybot.reply', r'registry\.Group')
self.assertResponse('config supybot.protocols.irc.throttleTime', '0.0') self.assertResponse('config supybot.protocols.irc.throttleTime', '0.0')
@ -49,6 +49,9 @@ class ConfigTestCase(ChannelPluginTestCase):
def testHelp(self): def testHelp(self):
self.assertError('config help alsdkfj') self.assertError('config help alsdkfj')
self.assertError('config help supybot.alsdkfj') self.assertError('config help supybot.alsdkfj')
self.assertNotRegexp('config list supybot', '.*alsdkfj.*')
self.assertError('config help supybot.plugins.AutoMode.ban.alsdkfj')
self.assertNotRegexp('config list supybot.plugins.AutoMode.ban', '.*alsdkfj.*')
self.assertNotError('config help supybot') # We tell the user to list. self.assertNotError('config help supybot') # We tell the user to list.
self.assertNotError('config help supybot.plugins') self.assertNotError('config help supybot.plugins')
self.assertNotError('config help supybot.replies.success') self.assertNotError('config help supybot.replies.success')

View File

@ -206,7 +206,7 @@ class Group(object):
def __getattr__(self, attr): def __getattr__(self, attr):
if attr in self._children: if attr in self._children:
return self._children[attr] return self._children[attr]
elif self._supplyDefault: elif self._supplyDefault and attr.startswith('#'):
return self.__makeChild(attr, str(self)) return self.__makeChild(attr, str(self))
else: else:
self.__nonExistentEntry(attr) self.__nonExistentEntry(attr)

View File

@ -1,3 +1,3 @@
"""stick the various versioning attributes in here, so we only have to change """stick the various versioning attributes in here, so we only have to change
them once.""" them once."""
version = '0.83.4.1+limnoria (2011-07-03T17:09:53+0200)' version = '0.83.4.1+limnoria (2011-07-06T11:14:57+0200)'