diff --git a/.gitignore b/.gitignore index 7b1e282f2..9a9416fdd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,22 +1,23 @@ -backup -build -dist -supybot.egg-info -test-data -test-conf -test-logs -*.pyc -docs/_build -docs/plugins -*.swp -*.swo -*~ +#*# *.mo +*.py[co] +*~ +.*.s[a-w][a-p] +.s[a-w][a-p] +MANIFEST +backup/ +build/ debian/limnoria* debian/python-module-stampdir/ dist/ -push.sh +docs/_build/ +docs/plugins/ +limnoria.egg-info/ merge.sh -src/version.py -MANIFEST +push.sh py3k/ +src/version.py +supybot.egg-info/ +test-conf/ +test-data/ +test-logs/ diff --git a/plugins/Aka/plugin.py b/plugins/Aka/plugin.py index 293e18431..c0823d2b0 100644 --- a/plugins/Aka/plugin.py +++ b/plugins/Aka/plugin.py @@ -47,7 +47,7 @@ try: import sqlalchemy.ext import sqlalchemy.ext.declarative except ImportError: - raise callbacks.error('You have to install python-sqlalchemy in order ' + raise callbacks.Error('You have to install python-sqlalchemy in order ' 'to load this plugin.') if sqlalchemy: diff --git a/plugins/Google/plugin.py b/plugins/Google/plugin.py index 348cfbc87..cfc34b077 100644 --- a/plugins/Google/plugin.py +++ b/plugins/Google/plugin.py @@ -267,6 +267,8 @@ class Google(callbacks.PluginRegexp): while ',,' in result: result = result.replace(',,', ',null,') + while '[,' in result: + result = result.replace('[,', '[') data = json.loads(result) try: diff --git a/src/irclib.py b/src/irclib.py index eed0fbbff..d640ffc36 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -532,7 +532,11 @@ class IrcState(IrcCommandDispatcher): def do324(self, irc, msg): channel = msg.args[1] - chan = self.channels[channel] + try: + chan = self.channels[channel] + except KeyError: + chan = ChannelState() + self.channels[channel] = chan for (mode, value) in ircutils.separateModes(msg.args[2:]): modeChar = mode[1] if mode[0] == '+' and mode[1] not in 'ovh': @@ -543,7 +547,11 @@ class IrcState(IrcCommandDispatcher): def do329(self, irc, msg): # This is the last part of an empty mode. channel = msg.args[1] - chan = self.channels[channel] + try: + chan = self.channels[channel] + except KeyError: + chan = ChannelState() + self.channels[channel] = chan chan.created = int(msg.args[2]) def doPart(self, irc, msg): diff --git a/src/registry.py b/src/registry.py index 8519a6f66..1bce02c13 100644 --- a/src/registry.py +++ b/src/registry.py @@ -252,7 +252,9 @@ class Group(object): if not isValidRegistryName(name): raise InvalidRegistryName, name if node is None: - node = Group() + node = Group(private=self._private) + else: + node._private = node._private or self._private # We tried in any number of horrible ways to make it so that # re-registering something would work. It doesn't, plain and simple. # For the longest time, we had an "Is this right?" comment here, but diff --git a/test/test_registry.py b/test/test_registry.py index fb43c5572..b59f02daf 100644 --- a/test/test_registry.py +++ b/test/test_registry.py @@ -199,4 +199,29 @@ class ValuesTestCase(SupyTestCase): self.assertEqual(v(), 'bar') self.assertEqual(v(), 'foo') +class SecurityTestCase(SupyTestCase): + def testPrivate(self): + v = registry.String('foo', 'help') + self.assertFalse(v._private) + v = registry.String('foo', 'help', private=True) + self.assertTrue(v._private) + + g = registry.Group('foo') + v = registry.String('foo', 'help') + g.register('val', v) + self.assertFalse(g._private) + self.assertFalse(g.val._private) + + g = registry.Group('foo', private=True) + v = registry.String('foo', 'help') + g.register('val', v) + self.assertTrue(g._private) + self.assertTrue(g.val._private) + + g = registry.Group('foo') + v = registry.String('foo', 'help', private=True) + g.register('val', v) + self.assertFalse(g._private) + self.assertTrue(g.val._private) + # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: