On 10/7/07, Bill Moseley <[EMAIL PROTECTED]> wrote: > On Sun, Oct 07, 2007 at 09:40:37PM +0100, Paul Makepeace wrote: > > I'm wondering if there's been any discussion on augmenting TT with a > > pythonic (and many others) IN keyword. Allowing something awesomely > > compact and readable like, > > "IN" is already used. > > $ perl -MTemplate -le 'Template->new->process( \"[% x FOR x IN [1,2,3] %]" )' > 123
Oh noes! A keyword already exists! If only someone had figured out how to allow a token to have different context-dependent semantics... ;-) > > > > <input type="checkbox" name="[% name %]" value="[% val %]" > > [% IF val IN c.req.param(name); 'checked="checked"'; END %] /> > > > > I'm at a loss how to achieve that without building up a hash. Any tips? > > Hash is the way, I'd think. But, the tip I would give is to use one > of the many form generation and validation modules to do all that work > for you. Form processing is so common it's nice to abstract it out a bit. (Yeah, I've never had much luck with those. Seems like a nice idea until invariably you [well, I] run into something it doesn't cope with. I didn't particularly want to get side-tracked here on this though.) P > > -- > Bill Moseley > [EMAIL PROTECTED] > > > _______________________________________________ > templates mailing list > [email protected] > http://lists.template-toolkit.org/mailman/listinfo/templates > _______________________________________________ templates mailing list [email protected] http://lists.template-toolkit.org/mailman/listinfo/templates
