[Zope] ZPublisher and creating children

Paul Everitt Paul@digicool.com
Wed, 3 Mar 1999 08:54:47 -0500


Cees wrote:
> 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?

Actually this example shows the beauty of Zope/Bobo programming -- the
code looks completely like normal Python code, no CGI hackery involved.

Anyway, this is really a Python question, IMO.  You don't the arguments
to the Child's constructor to be hardwired in the Parent, right?

You could take a route where pass a dictionary, e.g. REQUEST, into the
Child's constructor and let it figure out for itself what it needs.
This feels less OO and doesn't let Zope/Bobo help you with type
conversions and raising exceptions for missing arguments.

--Paul