[Zope] dtml-if question

Casey Duncan cduncan@kaivo.com
Wed, 27 Jun 2001 13:41:35 -0600


Oops Oops wrote:
> 
> I guess i did something wrong on this, so it's not
> work?
> 
> <dtml-if expr="objectValues('newclient')==''">
>  <br> Null
> <dtml-else>
>  <br> Not Null
> </dtml-if>
> 
> My idea is to test if Zobject-newclient exist in this
> folder or not.
> But i always get "Not Null" even tho I'm sure there is
> no newclient exist in the folder.
> 
> Can someone help me to fix this?
> 
> Thanks
> 

ObjectValues returns a list of objects optionally filtered by meta_type.
To test for the existence of an id in a folder, the best way is
probably:

<dtml-if expr="'newclient' in folder.objectIds()">
...
</dtml-id>

Which will return true if 'newclient' is in the list of object ids for
the folder (you can omit the folder designation to refer to the current
folder, however if won't work without it if you code this in a DTML
document).

hth,
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>