Fix0red the bugz0r.

This commit is contained in:
Jeremy Fincher 2004-09-14 15:30:16 +00:00
parent da5fd46bb1
commit 5f1aa43ee0

View File

@ -105,7 +105,7 @@ def close(registry, filename, annotated=True, helpOnceOnly=False):
lines.append('###\n') lines.append('###\n')
fd.writelines(lines) fd.writelines(lines)
if hasattr(value, 'value'): # This lets us print help for non-valued. if hasattr(value, 'value'): # This lets us print help for non-valued.
fd.write('%s: %s\n' % (name, value)) fd.write('%s: %s\n' % (name, value.serialize()))
fd.close() fd.close()
def isValidRegistryName(name): def isValidRegistryName(name):
@ -310,6 +310,9 @@ class Value(Group):
def __str__(self): def __str__(self):
return repr(self()) return repr(self())
def serialize(self):
return str(self)
# We tried many, *many* different syntactic methods here, and this one was # We tried many, *many* different syntactic methods here, and this one was
# simply the best -- not very intrusive, easily overridden by subclasses, # simply the best -- not very intrusive, easily overridden by subclasses,
# etc. # etc.
@ -469,8 +472,9 @@ class Regexp(Value):
"""Value must be a valid regular expression.""" """Value must be a valid regular expression."""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
kwargs['setDefault'] = False kwargs['setDefault'] = False
super(Regexp, self).__init__(*args, **kwargs) self.sr = ''
self.value = None self.value = None
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