Following what you said, I would have expected the html result to be:

<tr>
<td>first</td>
<td>
<td>second</td>
<td>third</td>
</td>
</tr>

In any case, the following syntax would have been a work-around for
the "SyntaxError: only named arguments may follow *expression" but
only if the extra <td> wasn't there.
{{=TABLE(TR(TD('first'),[TD(x) for x in arr],TD('fourth')))}}



On Sep 1, 12:53 pm, Anthony <abasta...@gmail.com> wrote:
> By the way, the reason you got the output you did is because TR expects its
> positional arguments to be TD's, and if they are not, it wraps them in a TD.
> In your case, your second positional argument was a list, so TR wrapped it
> in a TD for you (it turned out that your list itself contained two TD's, so
> they ended up inside another TD).
>
> Anthony
>
>
>
>
>
>
>
> On Wednesday, August 31, 2011 8:31:09 PM UTC-4, Noel Villamor 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 <abas...@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]))}}

Reply via email to