[Zope] conditionals inside dtml-let expressions
   
    Mitchell Model
     
    mlm@acm.org
       
    Thu, 18 Oct 2001 12:56:02 -0400
    
    
  
--============_-1208698328==_ma============
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
Is there a straightforward way to bind one of two values to a let 
variable depending on the value of another variable?  In C/C++/Java I 
would use the ?: operator, but Python doesn't have that.  Or should I 
just bind the variable to None then set it later with something like
<dtml-let var=None>
   <dtml-if "testvar==targetval">
     <dtml-var expr="_.set(var, 'yes')>
   <dtml-else>
     <dtml-var expr="_.set(var, 'no')>
   </dtml-if>
</dtml-let>
--============_-1208698328==_ma============
Content-Type: text/html; charset="us-ascii"
<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
 --></style><title>conditionals inside dtml-let
expressions</title></head><body>
<div>Is there a straightforward way to bind one of two values to a let
variable depending on the value of another variable?  In
C/C++/Java I would use the ?: operator, but Python doesn't have that. 
Or should I just bind the variable to None then set it later with
something like</div>
<div><br></div>
<blockquote><dtml-let var=None></blockquote>
<blockquote>  <dtml-if
"testvar==targetval"></blockquote>
<blockquote>    <dtml-var expr="_.set(var,
'yes')></blockquote>
<blockquote>  <dtml-else></blockquote>
<blockquote>    <dtml-var expr="_.set(var,
'no')></blockquote>
<blockquote>  </dtml-if></blockquote>
<div></dtml-let></div>
</body>
</html>
--============_-1208698328==_ma============--