[Zope] Re: How to delete image from DTML-CALL?
Josef Meile
jmeile@hotmail.com
Fri, 4 Jul 2003 10:31:57 +0200
--- In zope@yahoogroups.com, "Jaroslav Lukesh" <lukesh@s...> wrote:
> Hi all,
>
> I want to delete all images recursively from my web tree by using this
> recursive DTML Method delimage (errorfull):
>
> <dtml-in "objectItems(['Folder', 'ZipFolder', 'Image' ])"
> skip_unauthorized>
> <dtml-if "objectValues()=='Image'">
> DEL: <dtml-var absolute_url><br>
> <dtml-call "manage_delObjects(id)">
> <dtml-else>
> <dtml-with sequence-item>
> <dtml-var delimage>
> </dtml-with>
> </dtml-if>
> </dtml-in>
I think that the <dtml-with sequence-item> should be before
everything in the dtml-if. If I'm not wrong, when you make
<dtml-call "manage_delObjects(id)">, you're refering to the
parent object (a dtml method) and not to the object in question.
I think this should do the job:
<dtml-in "objectItems(['Folder', 'ZipFolder', 'Image' ])"
skip_unauthorized>
<dtml-with sequence-item>
<dtml-if "meta_type=='Image'">
DEL: <dtml-var absolute_url><br>
<dtml-call "manage_delObjects(id)">
<dtml-else>
<dtml-var delimage>
</dtml-if>
</dtml-with>
</dtml-in>
Anyway, I think that recursive DTML Methods aren't a good
idea. As Andy said, it's better to use a python script, so that you
won't get confused about Namespaces and it will look cleaner.
Regards,
Josef