[Zope-Checkins] CVS: Zope/lib/python/HelpSys - APIHelpTopic.py:1.11

Amos Latteier amos@zope.com
Tue, 16 Oct 2001 20:08:46 -0400


Update of /cvs-repository/Zope/lib/python/HelpSys
In directory cvs.zope.org:/tmp/cvs-serv6569

Modified Files:
	APIHelpTopic.py 
Log Message:
Added support for documenting Functions to API help topics. This is necessary to support help for things like PythonScripts.standard and the sequence module. Before the sequence module was DTML help, but that's wasn't right. This is especially obvious now the Python-based scripts and Page Templates can use the sequence module.


=== Zope/lib/python/HelpSys/APIHelpTopic.py 1.10 => 1.11 ===
 
     isAPIHelpTopic=1
+    funcs=() # for backward compatibility
     
     def __init__(self, id, title, file):
         self.id=id
@@ -114,6 +115,7 @@
         self.doc=dict.get('__doc__','')
 
         self.apis=[]
+        self.funcs=[]
         for k, v in dict.items():
             if (not _ignore_objects.has_key(k) or
                 _ignore_objects[k] is not v):
@@ -123,7 +125,9 @@
                 elif (hasattr(v, 'isImplementedByInstancesOf')):
                     # A scarecrow interface.
                     self.apis.append(APIDoc(v, 1))
-
+                elif type(v)==types.FunctionType:
+                    # A function
+                    self.funcs.append(MethodDoc(v, 0))
         # try to get title from first non-blank line
         # of module docstring
         if not self.title:
@@ -145,7 +149,7 @@
     def SearchableText(self):
         "The full text of the Help Topic, for indexing purposes"
         text="%s %s" % (self.title, self.doc)
-        for api in self.apis:
+        for api in self.apis + self.funcs:
             text="%s %s" % (text, api.SearchableText())
         return text