[Zope3-checkins] SVN: Zope3/branches/Zope-3.1/src/zope/app/apidoc/codemodule/module.py Merge revision 38347 from trunk, letting APIdoc work with extended module

Gary Poster gary at zope.com
Wed Sep 7 13:59:19 EDT 2005


Log message for revision 38348:
  Merge revision 38347 from trunk, letting APIdoc work with extended module
  paths.
  
  

Changed:
  U   Zope3/branches/Zope-3.1/src/zope/app/apidoc/codemodule/module.py

-=-
Modified: Zope3/branches/Zope-3.1/src/zope/app/apidoc/codemodule/module.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/apidoc/codemodule/module.py	2005-09-07 17:48:01 UTC (rev 38347)
+++ Zope3/branches/Zope-3.1/src/zope/app/apidoc/codemodule/module.py	2005-09-07 17:59:18 UTC (rev 38348)
@@ -59,33 +59,34 @@
                (self._module.__file__.endswith('__init__.py') or
                 self._module.__file__.endswith('__init__.pyc')or
                 self._module.__file__.endswith('__init__.pyo')):
-            dir = os.path.dirname(self._module.__file__)
-            for file in os.listdir(dir):
-                if file in IGNORE_FILES:
-                    continue
-                path = os.path.join(dir, file)
+            for dir in self._module.__path__:
+                for file in os.listdir(dir):
+                    if file in IGNORE_FILES or file in self._children:
+                        continue
+                    path = os.path.join(dir, file)
+    
+                    if (os.path.isdir(path) and
+                        '__init__.py' in os.listdir(path)):
+                        fullname = self._module.__name__ + '.' + file
+                        module = safe_import(fullname)
+                        if module is not None:
+                            self._children[file] = Module(self, file, module)
+    
+                    elif os.path.isfile(path) and file.endswith('.py') and \
+                             not file.startswith('__init__'):
+                        name = file[:-3]
+                        fullname = self._module.__name__ + '.' + name
+                        module = safe_import(fullname)
+                        if module is not None:
+                            self._children[name] = Module(self, name, module)
+    
+                    elif os.path.isfile(path) and file.endswith('.zcml'):
+                        self._children[file] = ZCMLFile(path, self._module,
+                                                        self, file)
+    
+                    elif os.path.isfile(path) and file.endswith('.txt'):
+                        self._children[file] = TextFile(path, file, self)
 
-                if os.path.isdir(path) and '__init__.py' in os.listdir(path):
-                    fullname = self._module.__name__ + '.' + file
-                    module = safe_import(fullname)
-                    if module is not None:
-                        self._children[file] = Module(self, file, module)
-
-                elif os.path.isfile(path) and file.endswith('.py') and \
-                         not file.startswith('__init__'):
-                    name = file[:-3]
-                    fullname = self._module.__name__ + '.' + name
-                    module = safe_import(fullname)
-                    if module is not None:
-                        self._children[name] = Module(self, name, module)
-
-                elif os.path.isfile(path) and file.endswith('.zcml'):
-                    self._children[file] = ZCMLFile(path, self._module,
-                                                    self, file)
-
-                elif os.path.isfile(path) and file.endswith('.txt'):
-                    self._children[file] = TextFile(path, file, self)
-
         # Setup classes in module, if any are available.
         zope.deprecation.__show__.off()
         for name in self._module.__dict__.keys():



More information about the Zope3-Checkins mailing list