Merge branch 'testing' of github.com:ProgVal/Limnoria into testing

This commit is contained in:
Valentin Lorentz 2013-10-28 14:17:23 +01:00
commit 5846059c3f
6 changed files with 58 additions and 20 deletions

33
.gitignore vendored
View File

@ -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/

View File

@ -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:

View File

@ -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:

View File

@ -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):

View File

@ -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

View File

@ -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: