[Zope] Test if document does exist

Farrell, Troy troy.farrell@wilcom.com
Thu, 22 Mar 2001 13:23:37 -0600


You can check if the parent (usually a folder object, unless we are in a
DTML Document, not a DTML method) has the special document object attribute.
(tested)

<dtml-if expr="_.hasattr(PARENTS[0], 'special_document_name')">
  We have special_document
<dtml-else>
  No joy.
</dtml-if>

This doesn't render the document or check to see if any of it's contents
will raise a KeyError.

Troy

-----Original Message-----
From: Chris Withers [mailto:chrisw@nipltd.com]
Sent: Thursday, March 22, 2001 12:25 PM
To: Marc Fischer
Cc: zope@zope.org
Subject: Re: [Zope] Test if document does exist


Marc Fischer wrote:
> 
> How can I test with an dtml-if, if a special document does exist?

<dtml-if special_document_name>

:-)

Chris

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