[Zope] (no subject)

Jay, Dylan djay@lucent.com
Mon, 26 Jun 2000 15:01:54 +1000


> -----Original Message-----
> From: Dieter Maurer [mailto:dieter@handshake.de]
> Sent: Saturday, June 24, 2000 8:11 AM
> To: Jay, Dylan
> Cc: 'zope@zope.org'
> Subject: Re: [Zope] (no subject)
> 
> 
> Jay, Dylan writes:
>  > Here's a feature I just submitted to the collector.
>  > 
>  > It seems to me that a few tweaks to the dtml-if syntax 
> would be beneficial
>  > something like the following would certainly clean up some 
> of the logic I
>  > end up writing.
>  > 
>  > <dtml-if X>
>  >  <a href="a_url">
>  > <dtml-always>
>  >  link text
>  > <dtml-else>
>  >  (no link currently available)
>  > <dtml-then>
>  >  </a>
>  > </dtml-if>
>  > 
>  > What do people think? I've not implemented it but I 
> wouldn't imagine its
>  > very hard.
> I am not in favor. It is only slightly shorter/more readable
> than the standard solution but requires two additional keywords.
> 
> In standard Zope, your example reads:
> 
> <dtml-if X>
>   <a href="a_url">
> </dtml-if>
> link text
> <dtml-if X>
>   </a>
> <dtml-else>
>   (no link available)
> </dtml-if>

Perhaps another example will prove its uglyness.

 <dtml-if "REQUEST.has_key('some_value') and this().has_key(some_value) and
_[some_value] == 'a property value' and
AUTHENTICATED_USER.has_role('Manager')">
  <a href="a_url">
 </dtml-if>
  link text
 <dtml-if "REQUEST.has_key('some_value') and this().has_key(some_value) and
_[some_value] == 'a property value' and
AUTHENTICATED_USER.has_role('Manager')">
   </a>
 <dtml-else>
   (no link available)
 </dtml-if>


or

<dtml-if "REQUEST.has_key('some_value') and this().has_key(some_value) and
_[some_value] == 'a property value' and
AUTHENTICATED_USER.has_role('Manager')">
  <a href="a_url">
<dtml-always>
  link text
<dtml-else>
  (no link currently available)
<dtml-then>
  </a>
</dtml-if>

Now which looks cleaner?