[Zope3-checkins] CVS: Zope3/src/zope/configuration - stxdocs.py:1.2
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Mar 29 10:09:09 EST 2004
Update of /cvs-repository/Zope3/src/zope/configuration
In directory cvs.zope.org:/tmp/cvs-serv21633/src/zope/configuration
Modified Files:
stxdocs.py
Log Message:
Support handler and print the information in the STX files.
=== Zope3/src/zope/configuration/stxdocs.py 1.1 => 1.2 ===
--- Zope3/src/zope/configuration/stxdocs.py:1.1 Thu Jan 22 18:53:15 2004
+++ Zope3/src/zope/configuration/stxdocs.py Mon Mar 29 10:09:08 2004
@@ -42,7 +42,7 @@
print >> sys.stderr, msg
sys.exit(code)
-def _directiveDocs(name, schema, info, indent_offset=0):
+def _directiveDocs(name, schema, handler, info, indent_offset=0):
"""Generate the documentation for one directive."""
# Write out the name of the directive
@@ -62,6 +62,11 @@
elif isinstance(info, (str, unicode)) and info:
text += wrap(info, 78, indent_offset+2)
+ # Insert Handler information
+ if handler is not None:
+ handler_path = handler.__module__ + '.' + handler.__name__
+ text += wrap('Handler: %s' %handler_path, 78, indent_offset+2)
+
# Use the schema documentation string as main documentation text for the
# directive.
text += wrap(schema.getDoc(), 78, indent_offset+2)
@@ -88,8 +93,10 @@
text = '\n Subdirectives\n\n'
sub_dirs = []
# Simply walk through all sub-directives here.
- for sd_ns, sd_name, sd_schema, sd_info in subdirs[(namespace, name)]:
- sub_dirs.append(_directiveDocs(sd_name, sd_schema, sd_info, 4))
+ subs = subdirs[(namespace, name)]
+ for sd_ns, sd_name, sd_schema, sd_handler, sd_info in subs:
+ sub_dirs.append(_directiveDocs(
+ sd_name, sd_schema, sd_handler, sd_info, 4))
return text + '\n\n'.join(sub_dirs)
return ''
@@ -110,9 +117,9 @@
os.mkdir(ns_dir)
# Create a file for each directive
- for name, (schema, info) in directives.items():
+ for name, (schema, handler, info) in directives.items():
dir_file = os.path.join(ns_dir, name+'.stx')
- text = _directiveDocs(name, schema, info)
+ text = _directiveDocs(name, schema, handler, info)
text += _subDirectiveDocs(subdirs, namespace, name)
open(dir_file, 'w').write(text)
More information about the Zope3-Checkins
mailing list