File: liveevil.py

package info (click to toggle)
nevow 0.3.0-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 940 kB
  • ctags: 2,089
  • sloc: python: 8,635; makefile: 15
file content (9 lines) | stat: -rw-r--r-- 503 bytes parent folder | download
1
2
3
4
5
6
7
8
9
"""A liveevil server in four lines.
Text inputted into the input box on the page is routed to the server,
and the server echoes it back in an alert box.
"""

from nevow import liveevil, inevow, tags, rend, loaders
from twisted.internet import reactor
reactor.listenTCP(8080, liveevil.LiveSite(rend.Page(docFactory=loaders.stan(tags.html[tags.head[liveevil.glue], tags.body[ tags.input(type="text", onchange=liveevil.handler(lambda client, text: client.alert(text), "node.value"))]]))))
reactor.run()