mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-12 21:22:36 +01:00
registry: Fix regression preventing default None value for Regexp.
This commit is contained in:
parent
6a3be33fcd
commit
23417b0675
@ -768,16 +768,22 @@ class Regexp(Value):
|
|||||||
# value of there parent change.
|
# value of there parent change.
|
||||||
v = (s, utils.str.perlReToPythonRe(s))
|
v = (s, utils.str.perlReToPythonRe(s))
|
||||||
else:
|
else:
|
||||||
v = ('', '')
|
v = None
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.error(e)
|
self.error(e)
|
||||||
else:
|
else:
|
||||||
super().set(v)
|
super().set(v)
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
|
if self.value is None:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
return self.value[1]
|
return self.value[1]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
if self.value is None:
|
||||||
|
return ''
|
||||||
|
else:
|
||||||
return self.value[0]
|
return self.value[0]
|
||||||
|
|
||||||
class SeparatedListOf(Value):
|
class SeparatedListOf(Value):
|
||||||
|
@ -182,8 +182,6 @@ class ValuesTestCase(SupyTestCase):
|
|||||||
self.assertTrue(v().match('foo'))
|
self.assertTrue(v().match('foo'))
|
||||||
v.set('')
|
v.set('')
|
||||||
self.assertEqual(v(), None)
|
self.assertEqual(v(), None)
|
||||||
self.assertRaises(registry.InvalidRegistryValue,
|
|
||||||
v.setValue, re.compile(r'foo'))
|
|
||||||
|
|
||||||
def testBackslashesKeys(self):
|
def testBackslashesKeys(self):
|
||||||
conf.supybot.reply.whenAddressedBy.strings.get(':foo').set('=/*')
|
conf.supybot.reply.whenAddressedBy.strings.get(':foo').set('=/*')
|
||||||
|
Loading…
Reference in New Issue
Block a user