[Zope3-dev] Re: proposed changes to contained helper functions

Philipp von Weitershausen philipp at weitershausen.de
Fri Oct 3 07:14:29 EDT 2003


Fred L. Drake, Jr. wrote:
> Garrett Smith writes:
>  > It seems your application is a bit different from a typical __setitem__ 
>  > scenario, where the child is named.
> 
> That depends on whether you're thinking of sequence __setitem__ or
> mapping __setitem__.  ;-(  The DOM is mostly about sequences of
> children; the children have indexes, but not names.  The indexes are
> not specific to the node being referenced, but change as nodes are
> added and removed before the child in the parent.  (Think of an
> element node as a list of children.)

Correct. Basically, I would like to express parenthood without having to 
make any assumptions on a) how the parent names its child (if it names 
it at all) nor b) how it stores a reference to it (if it stores one at all).

> The container ideas are really founded on the mapping interface, so I
> suspect the DOM should avoid __name__, and only implement __parent__
> as a read-only property that returns self.parentNode.

That's how the DOM implementation in my sandbox does it right now (if 
only I could get all the tests pass ;)).
I have so far implemented my own machinery to deal with parenting; it's 
not much since it only covers the cases I need for DOM. I would really 
like to see some kind of general parenthood machinery in Zope3, though. 
As I said earlier this thread: as a subset of the container ideas...

   * parenthood + mapping interface = container ideas

   * parenthood + index interface = DOM, music charts hitlist, etc.

   * ...

Smells like a proposal, eh?

Philipp





More information about the Zope3-dev mailing list