[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.

Christian Theune ct at gocept.com
Fri Apr 24 03:17:56 EDT 2009


Hi,

On Fri, 2009-04-24 at 16:14 +0900, Yusei TAHARA wrote:
> 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:-)

Thanks for the excellent explanation! I didn't see that the functional
tests were already failing and this is a fix for it. In the case that
you're fixing an already existing an failing test, I usually mention
that in the commit message, so people know I haven't forgotten about
writing tests.

Christian

-- 
Christian Theune · ct at gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 7 · fax +49 345 1229889 1
Zope and Plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/checkins/attachments/20090424/fd7a31a1/attachment.bin 


More information about the Checkins mailing list