[Zope3-checkins] SVN: Zope3/branches/Zope-3.1/ Fixed a bug that prohibited the interfaces attrs and methods belong to not

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


Log message for revision 37688:
  Fixed a bug that prohibited the interfaces attrs and methods belong to not 
  to be shown.
  

Changed:
  U   Zope3/branches/Zope-3.1/doc/CHANGES.txt
  U   Zope3/branches/Zope-3.1/src/zope/app/apidoc/codemodule/README.txt
  U   Zope3/branches/Zope-3.1/src/zope/app/apidoc/codemodule/class_.py

-=-
Modified: Zope3/branches/Zope-3.1/doc/CHANGES.txt
===================================================================
--- Zope3/branches/Zope-3.1/doc/CHANGES.txt	2005-08-03 20:31:16 UTC (rev 37687)
+++ Zope3/branches/Zope-3.1/doc/CHANGES.txt	2005-08-03 20:47:09 UTC (rev 37688)
@@ -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/branches/Zope-3.1/src/zope/app/apidoc/codemodule/README.txt
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/apidoc/codemodule/README.txt	2005-08-03 20:31:16 UTC (rev 37687)
+++ Zope3/branches/Zope-3.1/src/zope/app/apidoc/codemodule/README.txt	2005-08-03 20:47:09 UTC (rev 37688)
@@ -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/branches/Zope-3.1/src/zope/app/apidoc/codemodule/class_.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/apidoc/codemodule/class_.py	2005-08-03 20:31:16 UTC (rev 37687)
+++ Zope3/branches/Zope-3.1/src/zope/app/apidoc/codemodule/class_.py	2005-08-03 20:47:09 UTC (rev 37688)
@@ -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