Fixed Regexp.

This commit is contained in:
Jeremy Fincher 2004-09-09 19:13:46 +00:00
parent 1745e091f6
commit bebe005584

View File

@ -259,7 +259,7 @@ class Group(object):
class Value(Group): class Value(Group):
"""Invalid registry value. If you're getting this message, report it, """Invalid registry value. If you're getting this message, report it,
because we forgot to put a proper help string here.""" because we forgot to put a proper help string here."""
def __init__(self, default, help, def __init__(self, default, help, setDefault=True,
private=False, showDefault=True, **kwargs): private=False, showDefault=True, **kwargs):
self.__parent = super(Value, self) self.__parent = super(Value, self)
self.__parent.__init__(**kwargs) self.__parent.__init__(**kwargs)
@ -267,6 +267,7 @@ class Value(Group):
self._private = private self._private = private
self.showDefault = showDefault self.showDefault = showDefault
self.help = utils.normalizeWhitespace(help.strip()) self.help = utils.normalizeWhitespace(help.strip())
if setDefault:
self.setValue(default) self.setValue(default)
def error(self): def error(self):
@ -459,6 +460,10 @@ class StringWithSpaceOnRight(String):
class Regexp(Value): class Regexp(Value):
"""Value must be a valid regular expression.""" """Value must be a valid regular expression."""
def __init__(self, *args, **kwargs):
kwargs['setDefault'] = False
super(Regexp, self).__init__(*args, **kwargs)
def error(self, e): def error(self, e):
raise InvalidRegistryValue, 'Value must be a regexp of the form %s' % e raise InvalidRegistryValue, 'Value must be a regexp of the form %s' % e