[Zope] ZClass Adding Magic Needed

Jim Washington jwashin@vt.edu
Wed, 17 Jan 2001 08:08:57 -0500


Hi, Geoff

Your situation looks like application logic confusion enhanced by the
weirdness of DTML.

Use a Python Script/Method to do the background heavy lifting. If you
are using <with>, <let>  and REQUEST.set() to access your items, it can
be done much more simply and understandably in a Python Script/Method.  

-- Jim Washington

"Geoffrey L. Wright" wrote:
> 
> So:
> 
> I have a odd little problem that I can't seem to solve.  I have two
> zclasses.  We'll call them zclass1 and zclass2.  zclass2 lives inside
> of zclass1.  zclass1 has the following two properties:  id and
> displayOrder.  zclass2 has the four properties: id, displayOrder,
> alignment and content.  In both cases the id is an automaticly
> generated unique number based on ZopeTime.
> 
> My problem is that I need to make a public add method that generates a
> new instance of zclass1 with a new instance of zclass2 inside of it.
> I also need to be able to control set the displayOrder of zclass1, and
> the alignment and content of zclass2 from the same form.  The
> displayOrder of zclass2 will be static for the time being, but I'll
> ultimately need to control that as well.
> 
> I hacked the default add method of zclass1 so that it generates a new
> instance of zclass2 each time, and using the Job Board HOWTO I managed
> to make a public add method.  So far so good.  But now I can't for the
> life of me figure out how to pass some form variables to one object
> and some to the other, especially while they have some identically named
> properties.
> 
> Any hints on this one?