-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Rik Hoekstra Sent: Wednesday, August 25, 1999 4:35 PM To: Heiko Stoermer; zope@zope.org Subject: [Zope] Acquisition mysteries
-----Original Message----- From: stoermer@migserv.augsburg.mig.net [mailto:stoermer@migserv.augsburg.mig.net]On Behalf Of Heiko Stoermer Sent: Wednesday, August 25, 1999 3:13 PM To: Rik Hoekstra Subject: Re: [Zope] manage_clone problem
thanks a lot, the PARENTS[0] expression solved my problem. I you have time: could you, in short, explain to me why that worked? (yes, I am a newbie...)
Greetings, Heiko
OK, I'll try, though it's complicated, and I do not completely understand myself.... Given the following folder structure:
root - DTML Method | DTML Document | current folder
The famous acquisition 'enables' an object to call a property from a parent object as if it were its own. If you use a DTML Method the calling object is the folder that you call from (current folder in the example), because the DTML method 'acts' as if it were only a property of the current folder. So if you call manage_clone from a DTML Method it 'thinks' it is called from the current folder. It then 'clones' the object to the current folder. A DTML Document, however, is an object of its own, and it can't contain other object. So if you call manage_clone from a DTML Document it will try to clone it to itself, and *for one reason or another* ends up with the folder it's called from.
Woops, a typo. What I meant was: it ends up with its original folder (the root folder in the example)
Apparently acquisition thinks that is its nearest parent... Could someone with fuller understanding of acquisition explain this??? Is this a bug or a feature?
If you add a <dtml-with expr="PARENTS[0]"> the object manage_clone is not called from the DTML Document, but from its nearest parent, which is the folder in the context of which it is called (current folder in the example). This works (at least for me) as expected, but why this parent is not found automatically escapes me...
Rik
Rik Hoekstra wrote:
To: Zope Mailing List <zope@zope.org> Subject: [Zope] manage_clone problem
I have created a DTML Document in the root directory that is supposed to be used from all subdirs of my web application. This document contains a call to manage_clone(), which
should copy an
object from some other folder into the _current_ folder. But as the DTML is stored in the root directory, manage_clone always clones into the _rootdir_, too.
this is the call: <!--with "manage_clone(foo.bar,'new_id',REQUEST)"-->
I have done something very similar, with success. I only used a DTML method to do the manage_cloning. As this seems to be a namespace issue, you could try to change to a DTML method or perhaps a <dtml-with "PARENTS[0]"> would help.
Rik Hoekstra
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
-- Heiko Stoermer MIG Augsburg
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )