[Zope] How to check for a folder's existence and create it if it doesn'texist?

Paul Zwarts paul.zwarts@oratrix.com
Wed, 28 Feb 2001 17:54:42 +0100


Hi!

Perhaps something like this:

<dtml-in expr="objectValues('Folder')">
   <dtml-if id==2001>
       Matches
   <dtml-else>
       <dtml-call "nameofFolder.manage_addFolder('titleofFolder', 'something
else?')">
   </dtml-if>
</dtml-in>

You'll have to check if that actually works, because somehow it seems wrong...
but anyhow, It should be enough to go on....

Im pretty much a newbie, but I had alot of help from the list today, so I try
to return the favour : )
Cheers,
Paz


Chris Muldrow wrote:

> 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 )