File: canvas.tac

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 (25 lines) | stat: -rw-r--r-- 640 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25


from nevow import canvas

from nevow import rend

from twisted.application import service
from twisted.application import internet
from nevow import appserver

words = open('/usr/share/dict/words').readlines()

class Reloader(rend.Page):
    canvas = None
    def locateChild(self, ctx, segs):
        if segs == ('',):
            reload(canvas)
            self.canvas = canvas.Canvas(words)
            self.canvas.addSlash = True
            return self.canvas, segs
        return self.canvas, segs


application = service.Application("canvas")
internet.TCPServer(8080, appserver.NevowSite(Reloader())).setServiceParent(application)