[Checkins] SVN: zope.app.apidoc/trunk/src/zope/app/apidoc/codemodule/module.py If there is something the same name beneath, then module should have priority.

Yusei TAHARA yusei at domen.cx
Fri Apr 24 03:14:10 EDT 2009


Hi,


On Fri, 24 Apr 2009 07:35:25 +0200
Christian Theune <ct at gocept.com> wrote:

> Hi there,
> 
> On Thu, 2009-04-23 at 11:11 -0400, Yusei Tahara wrote:
> > Log message for revision 99417:
> >   If there is something the same name beneath, then module should have priority.
> >   
> > 
> > Changed:
> >   U   zope.app.apidoc/trunk/src/zope/app/apidoc/codemodule/module.py
> > 
> > -=-
> > Modified: zope.app.apidoc/trunk/src/zope/app/apidoc/codemodule/module.py
> > ===================================================================
> > --- zope.app.apidoc/trunk/src/zope/app/apidoc/codemodule/module.py	2009-04-23 04:59:07 UTC (rev 99416)
> > +++ zope.app.apidoc/trunk/src/zope/app/apidoc/codemodule/module.py	2009-04-23 15:11:16 UTC (rev 99417)
> > @@ -124,6 +124,11 @@
> >                      names.append(name)
> >  
> >          for name in names:
> > +            # If there is something the same name beneath, then module should
> > +            # have priority.
> > +            if name in self._children:
> > +                continue
> > +
> >              attr = getattr(self._module, name, None)
> >              if attr is None:
> >                  continue
> 
> Is there a chance you can elaborate on that comment a little bit more? I
> looked at the code but didn't understand whats going on (that function
> is hard to read already, I know). Also: any chance to a get (small) test
> that demonstrates what you changed there?
> 
> Christian
> 

Yes, I will update my comment later. And I will explain my change now.

Why I changed this because currently some functional tests in zope.app.apidoc
fails and one of the errors was due to duplicated zope.schema.accessors.
(I'll fix all these errors soon)

In zope.schema, there are two "accessors", one is a module(accessors.py) and
the other is a function. The module is overriden by the function intentionaly.
This is not a problem, but IMO accessors.py should be displayed in apidoc
instead of the function(this is current behavior), even if this module was
overriden in the parent module namespace, because apidoc is basically a tool
for showing existing source files and the function which overrides the module
is imported from other module.

And about test, there is already a functional test which detect this problem.
So, in this case I did not write additional one.

Is this explanation enough? Thank you for your comment:-)

Best regards,
-- 
Yusei TAHARA <yusei at domen.cx>


More information about the Checkins mailing list