UL([ LI(A(l.upper(), _href='#tab'+str(i), **{'_data-toggle':'tab'})) for i,
l in enumerate(list_of_letters_required) ], _class='nav nav-tabs')

Only one pairs of curly brackets and the attribute needs to be quoted since
it is a key dict finally...

Thanks!

Richard

On Wed, Oct 3, 2012 at 1:44 PM, Richard Vézina
<[email protected]>wrote:

> Great, I thought about it, I should read the book before sorry!
>
> Richard
>
>
> On Wed, Oct 3, 2012 at 1:33 PM, Paolo Caruccio <[email protected]
> > wrote:
>
>> Please put the attribute with the hyphen in a dictionary:
>>
>> UL([ LI(A(l.upper(), _href='#tab1', **{{_data-toggle:'tab'}})) for l 
>> inlist_of_letters_required
>> ], _class='nav nav-tabs')
>>
>> From web2py book
>> http://web2py.com/books/default/chapter/29/5#HTML-helpers:
>>
>> *Instead of a set of unnamed arguments, a helper can also take a single
>> list or tuple as its set of components using the * notation and it can take
>> a single dictionary as its set of attributes using the ***
>>
>> For a deep explanation of this error please read
>> https://groups.google.com/d/msg/web2py/ZGI7xZFPx3s/3PMwSnF-k-IJ
>>
>> Il giorno mercoledì 3 ottobre 2012 18:47:20 UTC+2, Richard ha scritto:
>>
>>> Hello,
>>>
>>> I would generate programmatically a bunch of links with A() helper from
>>> controller, but I fall on syntax error because of data-toggle custom
>>> bootstrap attribute (new with html5).
>>>
>>> Ex.: UL([ LI(A(l.upper(), _href='#tab1', *_data-toggle='tab'*)) for l
>>> in list_of_letters_required ], _class='nav nav-tabs')
>>>
>>> Can I pass a arbitrary argument with helpers or should I alter the
>>> helper??
>>>
>>> Also, since this new html5 feature mean a lot of new attribute all the
>>> time what's the plan about that, we can stay behind waiting for new
>>> _Attribute get implement all the time...
>>>
>>> Thanks.
>>>
>>> Richard
>>>
>>  --
>>
>>
>>
>>
>
>

-- 



Reply via email to