[Twisted-web] How to insert an Athena event handler using Stan?

Tristan Seligmann mithrandi-twisted-web at mithrandi.za.net
Tue Oct 31 07:12:39 CST 2006


* kgi <iacovou at gmail.com> [2006-10-31 11:58:35 +0200]:

> However, if one has stan-based rather than file-based XHTML, it's neither 
> documented nor obvious how this should be done. I've managed to get this far:
> 
>     from nevow import stan
>     ...
>     _athena = stan.Proto (
>         'athena:handler event="onkeypress" handler="keyPressed"'
>     )
>     ...
>     T.input ( type = "text", _class = "sw-input" ) [ _athena ]

stan.Proto takes a tag name, so you would really want
just stan.Proto('athena:handler'). However, there's already one of these
in athena, so you can just do:

from nevow import stan, athena
# ...
T.input(type='text', _class='sw-input')[
    athena.handler(event='onkeypress', handler='keypressed']
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20061031/4e0aaf36/attachment.pgp


More information about the Twisted-web mailing list