[Zope] Instance within Instance
Dieter Maurer
dieter@handshake.de
Wed, 29 Nov 2000 00:43:58 +0100 (CET)
Daryl Stultz writes:
> Tim Cook wrote:
> > The problem here is that even though you set REQUEST, it is a
> > string. You need to be in the context of the parent _object_. You
> > should try <dtml-with "_.getitem(parent_id)">.
>
> Sorry, I thought of more...
> It's my understanding that dtml-with simply pushes a namespace onto the
> stack. What relationship does this have with the context that a new
> ZClass instance is created in?
"class2" is looked up in this namespace.
The top element is asked first for "class2".
"class2" is found (by acquisition) from your "class1" Z instance
(called "i1"). Thus, what is actually called is
(class2 __of__ i1).createInObjectManager(....)
"createInObjectManager" looks in "(class2 __of__ i1).aq_parent"
(this is "i1") for "_setObject".
Apparently, it does not find it there.
Then it looks at "i1.aq_parent" (this is the folder, "i1" is contained
in). There, it has success and creates the object.
Dieter