On Fri, Apr 3, 2009 at 3:20 PM, KLEIN Stéphane <klein.steph...@gmail.com> wrote: > >> def css_classes(value_condition_pairs): >> classes = [] >> for value, condition in value_condition_pairs: >> if condition: # Or ``if condition and value`` >> classes.append(value) >> return " ".join(classes) >> >> print css_classes([ >> ("firstcolumn", i == 0), >> ("asc", request.get("o")), >> ] >> >> How would that be? > > Very good. Only one thing : > > print HTML.th("foobar", class_="") > > return : <th class="">foobar</th> > > I would like <th>foobar</th>. > > Do you add "css_classes" feature in webhelpers repository ?
It works with a None argument. The function could be taught to do that. >>> print HTML.th("foobar", class_=None) <th>foobar</th> I'm still thinking about it, and waiting for any feedback from others on whether there's a better or more general solution. -- Mike Orr <sluggos...@gmail.com> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en -~----------~----~----~----~------~----~------~--~---