From 9eee85dc6348a4642b678d204672382176cccfb3 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 8 Apr 2004 10:59:13 +0000 Subject: [PATCH] I really should test these things before committing. --- src/conf.py | 1 + src/registry.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/conf.py b/src/conf.py index 74bacb144..3239af684 100644 --- a/src/conf.py +++ b/src/conf.py @@ -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 diff --git a/src/registry.py b/src/registry.py index 95abb13eb..06b18e0b5 100644 --- a/src/registry.py +++ b/src/registry.py @@ -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: