[Zope3-checkins] SVN: Zope3/trunk/ Backport of rev 37688.

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Aug 3 16:57:42 EDT 2005


Log message for revision 37689:
  Backport of rev 37688.
  

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/app/apidoc/codemodule/README.txt
  U   Zope3/trunk/src/zope/app/apidoc/codemodule/class_.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2005-08-03 20:47:09 UTC (rev 37688)
+++ Zope3/trunk/doc/CHANGES.txt	2005-08-03 20:57:41 UTC (rev 37689)
@@ -655,6 +655,10 @@
 
     Bug Fixes
 
+      - Fixed a bug in the codemodule of apidoc that prevented the class
+        documentation code to detect the interface in which an attribute,
+        property or method was declared.
+
       - Fix #421: TextArea widgets didn't handle missing values
         correctly.
 

Modified: Zope3/trunk/src/zope/app/apidoc/codemodule/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/codemodule/README.txt	2005-08-03 20:47:09 UTC (rev 37688)
+++ Zope3/trunk/src/zope/app/apidoc/codemodule/README.txt	2005-08-03 20:57:41 UTC (rev 37689)
@@ -131,21 +131,26 @@
   >>> klass.getAttributes()
   []
 
-  >>> klass.getMethods()[0]
-  ('get', <unbound method APIDocumentation.get>, None)
+  >>> klass.getMethods()[0] #doctest:+NORMALIZE_WHITESPACE
+  ('get', <unbound method APIDocumentation.get>, 
+   <InterfaceClass zope.interface.common.mapping.IReadMapping>)
 
 
 Let's have a closer look at the `getAttributes()` method. First we create an
 interface called `IBlah` that is implemented by the class `Blah`:
 
   >>> import zope.interface
-  >>> class IBlah(zope.interface.Interface):
+  >>> class IBlie(zope.interface.Interface):
+  ...      bli = zope.interface.Attribute('Blie')
+
+  >>> class IBlah(IBlie):
   ...      foo = zope.interface.Attribute('Foo')
 
   >>> class Blah(object):
   ...      zope.interface.implements(IBlah)
   ...      foo = 'f'
   ...      bar = 'b'
+  ...      bli = 'i'
   ...      _blah = 'l'
 
 The `Blah` class also implements a public and private attribute that is not
@@ -155,6 +160,7 @@
 
   >>> pprint(klass.getAttributes())
   [('bar', 'b', None),
+   ('bli', 'i', <InterfaceClass __builtin__.IBlie>),
    ('foo', 'f', <InterfaceClass __builtin__.IBlah>)]
 
 So, the function returns a list of tuples of the form (name, value,

Modified: Zope3/trunk/src/zope/app/apidoc/codemodule/class_.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/codemodule/class_.py	2005-08-03 20:47:09 UTC (rev 37688)
+++ Zope3/trunk/src/zope/app/apidoc/codemodule/class_.py	2005-08-03 20:57:41 UTC (rev 37689)
@@ -42,13 +42,9 @@
         self.__klass = klass
 
         # Setup interfaces that are implemented by this class.
-        self.__interfaces = list(implementedBy(klass))
+        self.__interfaces = tuple(implementedBy(klass))
         all_ifaces = {}
-        for iface in self.__interfaces:
-            all_ifaces[getPythonPath(iface)] = iface
-            for base in iface.__bases__:
-                all_ifaces[getPythonPath(base)] = base
-        self.__all_ifaces = all_ifaces.values()
+        self.__all_ifaces = tuple(implementedBy(klass).flattened())
 
         # Register the class with the global class registry.
         classRegistry[self.getPath()] = klass



More information about the Zope3-Checkins mailing list