Some random commits, NormalizedString, etc.

This commit is contained in:
Jeremy Fincher 2004-07-29 09:51:38 +00:00
parent 61793a489c
commit 30abebecbe

View File

@ -103,12 +103,15 @@ def close(registry, filename, annotated=True, helpOnceOnly=False):
lines.append('###\n')
fd.writelines(lines)
if hasattr(value, 'value'): # This lets us print help for non-valued.
fd.write('%s: %s\n' % (name, value))
fd.write('%s: %s\n' % (escape(name), value))
fd.close()
def isValidRegistryName(name):
return '.' not in name and ':' not in name and len(name.split()) == 1
def escape(name):
return name
def split(name):
# XXX: This should eventually handle escapes.
return name.split('.')
@ -367,12 +370,15 @@ class OnlySomeStrings(String):
self.error()
class NormalizedString(String):
def normalize(self, s):
return utils.normalizeWhitespace(s.strip())
def set(self, s):
s = utils.normalizeWhitespace(s.strip())
s = self.normalize(s)
String.set(self, s)
def setValue(self, s):
s = utils.normalizeWhitespace(s.strip())
s = self.normalize(s)
String.setValue(self, s)
class StringSurroundedBySpaces(String):