Hi Fred

Behalf Of Fred Drake
> Sent: Saturday, July 09, 2005 11:25 PM
> To: Florent Guillaume
> Cc: zope3-dev@zope.org
> Subject: Re: [Zope3-dev] ILocation vs IContained
> 
> On 7/8/05, Florent Guillaume <[EMAIL PROTECTED]> wrote:
> > I'm having a hard time grasping the reasons why we have both
> > ILocation and IContained.
> 
> The documentation is slim; I'd certainly appreciate hearing a
> definitive clarification from Jim as well.

Me too

> > class IContained(ILocation):
> >      """Objects contained in containers."""
> > 
> > But ILocation provides a __parent__ already, which seems to imply
> > that it's contained in it. No?
> 
> My own understanding is this:
> 
> - ILocation refers to the __parent__/__name__ API, which allows these
> attributes to have None as a value.
> 
> - IContained indicates that the object is actually contained in an
> IReadContainer, not just that it can be contained.

No, I don't think so. Or at least if you create a object
from it's factory e.g. in a addform this isn't true
till the object get added to the container.

... at least for content objects where inherited from
Contained and get the IContained inherited.

Or if this is true, what do we have to do, if a object
sometimes is stored in a IContainer and sometimes 
in a simply list. Is this a usecase where I can't use 
IContained? 

Other questions about IContained and the uncontained 
method:
Why do we not remove the ContainedProxy in the 
uncontained method and why do we delete the __name__
value. I know the container is responsible for set
the __name__ on objects. But what if we cut a object
from a IContainer paste it to a simply list? 
Is it really useful/relevant to delete the __name__
in the uncontained method?

btw,
I don't see any reason why we have to use IConatined.
We also could refactor the containedEvent event and use
ILocation directly for all usecases.

I think the IContained/IContainer.__setitem__pattern is 
usefull for __setitem__ constraints for custom container.
But also this could be done with interfaces not inherited 
form IContained since we don't have a base constraints for 
IContained on the IContainer.__setitem__ method.

Regards
Roger Ineichen

>   -Fred
> 
> -- 
> Fred L. Drake, Jr.    <fdrake at gmail.com>
> Zope Corporation
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev@zope.org
> Unsub: 
> http://mail.zope.org/mailman/options/zope3-dev/dev%40projekt01.ch
> 
> 

_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to