mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 21:29:24 +01:00
Fixed Regexp.
This commit is contained in:
parent
1745e091f6
commit
bebe005584
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user