[Zope] ZClasses

Dieter Maurer dieter@handshake.de
Tue, 18 Dec 2001 23:18:36 +0100


Stadtverwaltung Schwarzenberg writes:
 > I got a little, tiny Problem with ZClasses. I have 2 Classes, let's call
 > them foo1 (folderish object) and foo2. They both reside inside a single
 > Product - call it fooProduct. All I wanna do is to alter the (standard)
 > constructor of foo1 so that once an instance of foo1 is created another
 > instance of foo2 is created INSIDE foo1.
 > 
 > Right now I have:
 > contructor of foo1:
 > 
 > <dtml-with "foo1.createInObjectManager(REQUEST['id'], REQUEST)">
 >   <dtml-call "foo2_contrcutor('idoffoo2', REQUEST)">
 > </dtml-with>
 > 
 > contructor of foo2:
 > 
 > <dtml-with "foo2.createInObjectManager(id, REQUEST)">
 > </dtml-with>
 > 
 > 
 > but once I try to add a new foo1 instance I get *global name 'foo2' is not
 > defined*
Your "foo2_constructor" is a DTML object, right?

Then, this is a standard usage error for DTML objects:

  its two posistional arguemnts are essential to pass
  knowledge about the context into the DTML object.

Read "Calling DTML Objects" for details:

  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>


Dieter