Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
<% for .... %> <% endfor %> Syntax
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Calvin Young  
View profile  
 More options Sep 14 2012, 8:52 pm
From: Calvin Young <calvinwyo...@gmail.com>
Date: Fri, 14 Sep 2012 17:52:16 -0700 (PDT)
Local: Fri, Sep 14 2012 8:52 pm
Subject: <% for .... %> <% endfor %> Syntax

I just stumbled upon this post on Hacker News, in which one user suggests
writing a "for" loop using this syntax: <% for r in rows %> ${r.name} <%
endfor %>

http://news.ycombinator.com/item?id=388874

Seeing has how this post is over 3 years old, is this just the old Mako
syntax?  Is there any way to enable it in the latest version of Mako?  I
find it much more readable, so it'd be great to be able to use it.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Bayer  
View profile  
 More options Sep 14 2012, 9:56 pm
From: Michael Bayer <mike...@zzzcomputing.com>
Date: Fri, 14 Sep 2012 21:56:03 -0400
Local: Fri, Sep 14 2012 9:56 pm
Subject: Re: [Mako] <% for .... %> <% endfor %> Syntax

On Sep 14, 2012, at 8:52 PM, Calvin Young wrote:

> I just stumbled upon this post on Hacker News, in which one user suggests writing a "for" loop using this syntax: <% for r in rows %> ${r.name} <% endfor %>

> http://news.ycombinator.com/item?id=388874

> Seeing has how this post is over 3 years old, is this just the old Mako syntax?  Is there any way to enable it in the latest version of Mako?  I find it much more readable, so it'd be great to be able to use it.

that syntax is not correct.

the "for" block is via the % for / %endfor pair.

If you want a "for" all on one line, the best you can do is a list/generator comprehension:

${" ".join(r.name for r in rows)}


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »