I really should test these things before committing.

This commit is contained in:
Jeremy Fincher 2004-04-08 10:59:13 +00:00
parent 22fb1b41cb
commit 9eee85dc63
2 changed files with 6 additions and 0 deletions

View File

@ -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."""))
class ValidDriverModule(registry.OnlySomeStrings):
validStrings = ('socketDrivers', 'twistedDrivers', 'asyncoreDrivers')
def normalize(self, s):
# We can't be case insensitive here. At least not without work.
return s

View File

@ -299,6 +299,11 @@ class String(Value):
class OnlySomeStrings(String):
normalize = staticmethod(str.lower)
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):
s = self.normalize(s)
if s in self.validStrings: