[Zope] ZPublisher and creating children

Cees de Groot cg@acriter.com
Wed, 03 Mar 1999 09:58:29 +0100


Hi,

I'm using ZPublisher+DocumentTemplate+BoboPOS in a cgi environment,
because that's all I need (and can use on my ISP's box). In the couple
of things I've developed so far, a pattern has emerged that disturbs me:
if you have a container object, when adding a child, the whole add thing
is done in the parent. IIIRC, I fetched this design from the (Bobo)
Trinkets example when I started:

class Container....
     add = HTMLFile(....)
     def do_add(self, childattrone, childattrtwo, childattrthree):
        d = self._items
        d[childattrone] = Child(childattrone, childattrtwo,
childattrthree)
        self._items = d

class Child...

     def __init__(self, childattrone, childattrtwo, childattrthree):
         ....

     edit = HTMLFile(....)
     def do_edit(self, childattrone, childattrtwo, childattrthree):
           ....

The Container, IMHO, "knows" too much about the Child in this case, and
it's hard to modify the attribute set of the Child class. Am I doing
something wrong? Is there a design pattern here I'm not aware of?

Regards,

Cees