[Zope] Cloning objects to a ZClass instance
Rik Hoekstra
rik.hoekstra@inghist.nl
Thu, 20 Apr 2000 09:29:31 +0200
-----Original Message-----
From: Joachim Werner <joachim.werner@iuveno.de>
To: Rik Hoekstra <rik.hoekstra@inghist.nl>
Cc: zope@zope.org <zope@zope.org>
Date: donderdag 20 april 2000 9:04
Subject: Re: [Zope] Cloning objects to a ZClass instance
>> > I'd like to repeat a question to the list that seems to be more
complicated
>> > than I thought:
>> >
>> > What I want to do is have a template folder with default images etc. in
a
>> > container ZCLass. The item ZClasses in the container (e.g.
preconfigured member
>> > homepages of a portal site) should not just be able to use the
templates by
>> > aquisition, but the template folder should be physically copied to the
ZClass
>> > instances at creation time so that the template content can be easily
>> > customized within the instance.
>> >
>> > I tried manage_clone and other ways, but with no success so far.
>> >
>> > It must work in principle because I can do simple copy&paste in the
>> > management interface, and I guess everything that can be done there can
be done
>> > programmatically, too ...
>> >
>>
>> wouldn't
>>
>> <dtml-call "<ZClassinstance>.manage_clone(....)">
>>
>> or just calling the clone from the zclass instance work?
>>
>> Rik
>
>
>That's funny. I tried
>
><dtml-call "manage_clone(template,'clone_of_template')">
>
>in the section of the ZClass constructor where it says:
>
> "<dtml-comment>
>
> You can ad code that modifies the new instance here.
>
> For example, if you have a property sheet that you want to update
> from form values, you can call it here:
>
> </dtml-comment>"
>
>While adding empty folders or updating property sheets would work, the
>manage_clone wouldn't.
>
>But if I put the same line of code into the index_html file of the ZClass,
it
>will execute without problems when index_html is called.
>
>Why the difference?
I'm not completely sure, but probably the difference is just as the the
comment says, that in the constructor method you are working on the
instance. In the index_html you're working in the context of the instance.
Rik