[Twisted-web] Use nevow:pattern and nevow:attr to render a list of

Matt Goodall matt at pollenation.net
Fri Jul 6 05:23:44 EDT 2007


Daniel de la Cuesta wrote:
> Following your instructions I have done:
> 
>   <select>
>     <div nevow:render="formats">
>       <option nevow:pattern="option">
>         <nevow:attr name="value"><nevow:slot name="value" /></nevow:attr>
>         <nevow:slot name="label" />
>       </option>
>     </div>
>   </select>
> 
> On the other side I have:
> 
>     def render_formats(self, ctx, data):        
> 
>         for k,v in mydict.iteritems():
              pattern = ctx.tag.onePattern("option")
>             pattern.fillSlots('value', v).fillSlots('label', k)
> 
> But I cannot acces the pattern variable, what am I doing wrong?

pattern = ctx.tag.onePattern("option")

> 
> 
> Moe Aboulkheir escribió:
>> <option nevow:pattern="option">
>>  <nevow:attr name="value"><nevow:slot name="value" /></nevow:attr>
>>  <nevow:slot name="label" />
>> </option>
>>
>> You can then do pattern.fillSlots('value', '1').fillSlots('label',
>> 'Option 1') to get to something that'll serialize to <option
>> value="1">Option 1</option>.
>>
>> _______________________________________________
>> Twisted-web mailing list
>> Twisted-web at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>>
> 
> 
> -- 
> 
> *Daniel de la Cuesta Navarrete*
> *Técnico de Desarrollo de Software*
> 
> FUNDACIÓN IAVANTE
> daniel.cuesta at iavantefundacion.com
> Tel. 951 015 300
> 
> 
> Este correo electrónico y, en su caso, cualquier fichero anexo, contiene
> información confidencial exclusivamente dirigida a su(s)
> destinatario(s). Toda copia o divulgación deberá ser autorizada por IAVANTE.
> 
> This e-mail and any attachments are confidential and exclusively
> directed to its adressee(s). Any copy or distribution will have to be
> authorized by IAVANTE.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

-- 
Matt Goodall, Pollenation Internet Ltd
Technology House, 237 Lidgett Lane, Leeds LS17 6QR
Registered No 4382123
A member of the Brunswick MCL Group of Companies
w: http://www.pollenation.net/
e: matt at pollenation.net
t: +44 113 2252500



More information about the Twisted-web mailing list