[Zope] Test if an object exists in a folder

Max M maxm@mxm.dk
Thu, 01 Aug 2002 15:09:43 +0200


Hans Sandsdalen wrote:

>I tried these to check if content_html exists:
>
>1:   <dtml-if expr="_.has_key('content_html')">
>        Action!
>     <dtml-else>
>        Does not exist
>     </dtml-if>
>
>
>2:   <dtml-in expr="objectValues()">
>        <dtml-var getId><br>
>        <dtml-if expr="getId() == 'content_html'">
>           Action!
>        </dtml-if>
>     </dtml-in> 
>
>I'm not sure of the syntax of expr in the first example.
>
>The second one works, but it seems a like overkill to me. And how do I
>now later that I found it?
>  
>
what about:

<dtml-if content_html>
    Action!
<dtml-else>
    Doews not exist
</dtml-if>

or if it is without aquisition.

<dtml-if "aq_base.content_html()">
    Action!
<dtml-else>
    Doews not exist
</dtml-if>


regards Max M

-- 

"Sorry I would Really Like To Help More On This Project,
But Am To Busy Doing Paid Work On A Tight Deadline"
    Max M