Added support for groups alone having help.

This commit is contained in:
Jeremy Fincher 2004-02-07 23:35:42 +00:00
parent 2092fe4134
commit f2f2680c91

View File

@ -85,16 +85,18 @@ def close(registry, filename, annotated=True, helpOnceOnly=False):
first = False first = False
else: else:
lines.insert(0, '\n') lines.insert(0, '\n')
lines.append('#\n') if hasattr(value, 'value'):
try: lines.append('#\n')
original = value.value try:
value.value = value.default original = value.value
lines.append('# Default value: %s\n' % value) value.value = value.default
finally: lines.append('# Default value: %s\n' % value)
value.value = original finally:
value.value = original
lines.append('###\n') lines.append('###\n')
fd.writelines(lines) fd.writelines(lines)
fd.write('%s: %s\n' % (name, value)) if hasattr(value, 'value'): # This lets us print help for non-valued.
fd.write('%s: %s\n' % (name, value))
fd.close() fd.close()
@ -177,7 +179,7 @@ class Group(object):
L = [] L = []
for name in self.added: for name in self.added:
node = self.children[name] node = self.children[name]
if hasattr(node, 'value'): if hasattr(node, 'value') or hasattr(node, 'help'):
if node.__class__ is not self.X: if node.__class__ is not self.X:
L.append((node.name, node)) L.append((node.name, node))
if getChildren: if getChildren: