[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/apidoc/classmodule/ If one of the base classes is a C-class, then do not try to provide a

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Jul 7 09:44:44 EDT 2004


Log message for revision 26153:
If one of the base classes is a C-class, then do not try to provide a 
link to it, since it cannot be inspected. Instead just write the class 
name and path and tell the reader that it is a C-class.

Also, when searching for classes, sort the list of found classes.



-=-
Modified: Zope3/trunk/src/zope/app/apidoc/classmodule/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/classmodule/browser.py	2004-07-07 12:22:58 UTC (rev 26152)
+++ Zope3/trunk/src/zope/app/apidoc/classmodule/browser.py	2004-07-07 13:44:44 UTC (rev 26153)
@@ -18,8 +18,9 @@
 import os
 import inspect
 
+from zope.configuration.config import ConfigurationContext
+from zope.exceptions import NotFoundError
 from zope.interface import implementedBy
-from zope.configuration.config import ConfigurationContext
 from zope.proxy import removeAllProxies
 
 from zope.app import zapi
@@ -104,8 +105,10 @@
                     {'path': p,
                      'url': zapi.getView(klass, 'absolute_url', self.request)()
                      })
+        results.sort(lambda x, y: cmp(x['path'], y['path']))
         return results
 
+
 class FunctionDetails(object):
     """Represents the details of the function."""
 
@@ -172,11 +175,14 @@
         classModule = zapi.getUtility(IDocumentationModule, "Class")
         for base in self.context.getBases():
             path = getPythonPath(base)
-            klass = zapi.traverse(classModule, path.replace('.', '/'))
-            info.append(
-                {'path': path,
-                 'url': zapi.getView(klass, 'absolute_url',
-                                     self.request)()})
+            try:
+                klass = zapi.traverse(classModule, path.replace('.', '/'))
+                url = zapi.getView(klass, 'absolute_url', self.request)()
+            except NotFoundError:
+                # If one of the base classes is implemented in C, we will not
+                # be able to find it.
+                url = None
+            info.append({'path': path, 'url': url})
         return info
 
 

Modified: Zope3/trunk/src/zope/app/apidoc/classmodule/class_index.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/classmodule/class_index.pt	2004-07-07 12:22:58 UTC (rev 26152)
+++ Zope3/trunk/src/zope/app/apidoc/classmodule/class_index.pt	2004-07-07 13:44:44 UTC (rev 26153)
@@ -21,8 +21,12 @@
     <ul class="attr-list" tal:condition="bases">
       <li tal:repeat="base bases">
         <a href=""
-           tal:attributes="href string:${base/url}/index.html"
-           tal:content="base/path" />
+            tal:attributes="href string:${base/url}/index.html"
+            tal:content="base/path"
+            tal:condition="base/url" />
+        <div tal:condition="not: base/url">
+          <span tal:replace="base/path" /> (C-based class)
+        </div>
       </li>
     </ul>
     



More information about the Zope3-Checkins mailing list