Don't strip spaces when parsing registry values.

It breaks plugins.Messageparser.listSeparator, and probably others.
This commit is contained in:
Valentin Lorentz 2020-05-08 22:01:50 +02:00
parent bd1d7c9fa1
commit 43a8724d3a
2 changed files with 10 additions and 2 deletions

View File

@ -103,9 +103,9 @@ def open_registry(filename, clear=False):
else:
acc += line
try:
(key, value) = re.split(r'(?<!\\):', acc, 1)
(key, value) = re.split(r'(?<!\\): ', acc, 1)
key = key.strip()
value = value.strip()
value = value.strip('\r\n')
value = decoder(value)[0]
acc = ''
except ValueError:

View File

@ -200,6 +200,14 @@ class ValuesTestCase(SupyTestCase):
registry.open_registry(filename)
self.assertEqual(conf.supybot.reply.whenAddressedBy.chars(), '\\')
def testSpacesValues(self):
with conf.supybot.networks.test.password.context(' foo '):
self.assertEqual(conf.supybot.networks.test.password(), ' foo ')
filename = conf.supybot.directories.conf.dirize('spaces.conf')
registry.close(conf.supybot, filename)
registry.open_registry(filename)
self.assertEqual(conf.supybot.networks.test.password(), ' foo ')
def testWith(self):
v = registry.String('foo', 'help')
self.assertEqual(v(), 'foo')