[Zope] Checking for Property Presence

rgines@purina.com rgines@purina.com
Mon, 20 Dec 1999 12:43:10 -0600


I think I backed myself into a little corner.

I've got a directory with multiple DTML documents.   They do not all have
the same set of
properties.   I can pull the entire list fine, but everything that I have
tried to do to select
objects with a specific property fails on all of the DTML documents that do
not have
that property defined.    I have been unable to find something equivalent
to an
'if exists' type dtml tag which will check for the existence of a property
without trying
to check for a non-existent property value first.

I am assuming that this is not rocket science but a mental block on my
part.

Any assistance would be appreciated ... the code snippet is included with
the
troubling line that I need ...


<TABLE ALIGN="CENTER">
<dtml-tree branches_expr="objectValues(['DTML Document'])">
   <dtml-if "AUTHENTICATED_USER.has_permission('View',REQUEST)">
==>      <dtml-how do I check if the property exists "StaffLastName">
<====
         <tr><td><A HREF="<dtml-var absolute_url>">
             <IMG SRC="<dtml-var icon>" BORDER=0></a></td>
         <td><dtml-var title_or_id></td>
      </dtml-if>
   </dtml-if>
</dtml-tree>
</TABLE>


As a tangent, is there a way to define a new objectValue type within a Zope
product
without writing python source?