On Aug 31, 2011, at 5:50 PM, Noel Villamor wrote: > > By the way, the reason why I stumbled on this is because I wanted to > add a fourth TD to my test case. > > {{=TABLE(TR(TD('first'),*[TD(x) for x in arr],TD('fourth')))}} > or more simply > {{=TABLE(TR(TD('first'),*arr,TD('fourth')))}} > > But, this results to > SyntaxError: only named arguments may follow *expression > > The syntax appears reasonable to me. Perhaps in the future, developers > would consider allowing this.
You can, I think, supply a list of TDs to TR. The problem in your example is that you had a bare TD followed by a list of TDs. Instead of {{=TABLE(TR(TD('first'),[TD(x) for x in arr]))}} you could probably have said this: {{=TABLE(TR([TD('first')] + [TD(x) for x in arr]))}} > > On Sep 1, 12:31 pm, Noel Villamor <noe...@gmail.com> wrote: >> Just when I thought I have helped find a bug, I am faced with the >> revelation that I need to hone my python some more. He he he. >> >> Thanks Anthony. >> >> On Sep 1, 12:18 pm, Anthony <abasta...@gmail.com> wrote: >> >> >> >> >> >> >> >>> The problem is you are passing a list of TD's to TR instead of individual >>> TD's. Instead, try this: >> >>> {{=TABLE(TR(TD('first'),*[TD(x) for x in arr]))}} >> >>> Notice the "*" before the list comprehension -- that converts the list to a >>> set of positional arguments. >> >>> Anthony >> >>> On Wednesday, August 31, 2011 8:03:48 PM UTC-4, Noel Villamor wrote: >> >>>> To reproduce, create a view with the ff contents: >> >>>> <style type="text/css"> >>>> td { >>>> border-width: 5px; >>>> border-color: #000080; >>>> border-style: solid; >>>> } >>>> </style> >> >>>> {{arr=['second','third']}} >>>> {{=TABLE(TR(TD('first'),[TD(x) for x in arr]))}} >> >>>> HTML result: >> >>>> <table> >>>> <tbody> >>>> <tr> >>>> <td>first</td> >>>> <td></td> <-- This extra td should not be here >>>> <td>second</td> >>>> <td>third</td> >>>> </tr> >>>> </tbody> >>>> </table> >> >>>> Remarks: >> >>>> The bug does not show if there is no TD before the TD array. Thus, the >>>> following is OK. >>>> {{=TABLE(TR([TD(x) for x in arr]))}}