[Zope] Test of existance of attributes

mindlace mindlace@imeme.net
Wed, 26 Apr 2000 13:47:27 -0600


Sin Hang Kin wrote:
> 
> The code below do not works as I through: when the attribute expiredate is
> not defined, it raise an error instead of display the sequence-item.  How
> can I detect the existence of the attribute before comparision?

This annoys me to no end, but you can fix it like so:

> <dtml-in "objectValues(['DTML Document'])" sort="id" skip_unauthorized>

<dtml-if expiredate> 
> <dtml-if "expiredate and (expiredate - ZopeTime() ) >= 0.0 and not deleted">
> 
> <h2><dtml-var title_or_id></h2>
> <dtml-if "AUTHENTICATED_USER.has_permission( 'Change DTML Documents',
> _['sequence-item'])">
> <a href="manage_edit">Edit</a>
> </dtml-if>
> <dtml-if "(ZopeTime() - _['bobobase_modification_time']) > Newdate">
> <em>New</em>
> </dtml-if>
> <dtml-var sequence-item fmt="structured-text">
> </dtml-if>
</dtml-if>
> </dtml-in>

-- 
ethan mindlace fremen        mindlace@imeme.net
zope    -&-     imap email   -&-   mailing list
weave your web with the web at http://imeme.net