[Zope] How to check for a folder's existence and create it if itdoesn't exist?
Kees de Brabander
cj.de.brabander@hccnet.nl
Wed, 28 Feb 2001 21:50:11 +0100
I'm not shure if I understand you correctly, but this might do what you're
looking for:
<dtml-call REQUEST.set('folderExists', 0)
<dtml-in expr="objectValues('Folder')">
<dtml-if "id=='2001'">
<dtml-call REQUEST.set('folderExists', 1)
</dtml-if>
</dtml-in>
<dtml-if folderExists>
<dtml-else>
<dtml-call manage_addFolder....>
</dtml-if>
----- Original Message -----
From: Chris Muldrow <muldrow@mac.com>
To: <zope@zope.org>
Sent: Wednesday, February 28, 2001 5:40 PM
Subject: [Zope] How to check for a folder's existence and create it if
itdoesn't exist?
> I'm trying create a method to go through a site and create certain folders
> if they don't already exist. I can check for the existence of the folders
> with this:
>
>
> <dtml-in expr="objectValues('Folder')">
> <dtml-if "id=='2001'">
> It matches<p>
> </dtml-if>
>
> </dtml-in>
>
>
> But how do I craft the "else" to create the folder? Obviously, if I throw
> the <dtml-else> inside the "in" loop, it'll throw itself into the "else"
> action for every iteration where it doesn't find the named folder.
>
>
> -- Chris Muldrow, muldrow@mac.com
>
>
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>