mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
I really should test these things before committing.
This commit is contained in:
parent
22fb1b41cb
commit
9eee85dc63
@ -423,6 +423,7 @@ supybot.drivers.register('poll', registry.Float(1.0, """Determines the default
|
|||||||
length of time a driver should block waiting for input."""))
|
length of time a driver should block waiting for input."""))
|
||||||
|
|
||||||
class ValidDriverModule(registry.OnlySomeStrings):
|
class ValidDriverModule(registry.OnlySomeStrings):
|
||||||
|
validStrings = ('socketDrivers', 'twistedDrivers', 'asyncoreDrivers')
|
||||||
def normalize(self, s):
|
def normalize(self, s):
|
||||||
# We can't be case insensitive here. At least not without work.
|
# We can't be case insensitive here. At least not without work.
|
||||||
return s
|
return s
|
||||||
|
@ -299,6 +299,11 @@ class String(Value):
|
|||||||
class OnlySomeStrings(String):
|
class OnlySomeStrings(String):
|
||||||
normalize = staticmethod(str.lower)
|
normalize = staticmethod(str.lower)
|
||||||
validStrings = ()
|
validStrings = ()
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
assert self.validStrings, 'There must be some valid strings. ' \
|
||||||
|
'This is a bug.'
|
||||||
|
String.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
def setValue(self, s):
|
def setValue(self, s):
|
||||||
s = self.normalize(s)
|
s = self.normalize(s)
|
||||||
if s in self.validStrings:
|
if s in self.validStrings:
|
||||||
|
Loading…
Reference in New Issue
Block a user