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