[Twisted-web] Re: LivePage client.set()
Dave Cook
daverz at gmail.com
Tue Mar 22 02:08:17 MST 2005
On Tue, 22 Mar 2005 01:03:01 -0800, Dave Cook <daverz at gmail.com> wrote:
> Here's a simple example (attached).
Oops, that was a slightly diddled script. I'll just paste it in:
from twisted.internet import reactor
from nevow import loaders
from nevow import rend
from nevow import tags as T
from nevow import liveevil
choices = [[0,1,2], [3,4,5], [6,7,8]]
def setOptions(client, text):
client.set("target", [T.option[s] for s in choices[int(text)]])
myhandler = liveevil.handler(setOptions,
"node.options[node.selectedIndex].text")
class Page(rend.Page):
"""Example of using stan to render a page.
"""
addSlash = True
docFactory = loaders.stan(
T.html[
T.head[
liveevil.glue,
T.title['client.set test'],
],
T.body[
T.select(onchange=myhandler)[
[T.option[str(i)] for i in range(3)]
],
T.select(id="target"),
]
]
)
reactor.listenTCP(8080, liveevil.LiveSite(Page()))
reactor.run()
More information about the Twisted-web
mailing list