python - Mako templates inline if statement -


I have template variables, c.is_friend, I would like to use to determine whether the class is applicable or not . For example:

  if c.is_friend is true & lt; A href = "#" class = "friend" & gt; Link & lt; / A & gt; If c.is_friend is wrong & lt; A href = "#" & gt; Link & lt; / A & gt;  

Is there any way to inline such that:

   Link & lt; / A & gt;  

Or something like this?

The normal inline function of Python works:

  ; A href = "#" $ {'class = "buddy"' if c.is_friend else '}} & gt; Link & lt; / A & gt;  

Comments