1
from twisted.python import util
3
from nevow import inevow
4
from nevow import loaders
8
class Simple(rend.Page):
11
docFactory = loaders.xmlfile(util.sibpath(__file__, 'simplehtml.html'))
13
def render_theTitle(self, context, data):
14
return context.tag["Welcome to Nevow world"]
16
def render_sample(self, context, data):
17
request = inevow.IRequest(context)
18
session = inevow.ISession(context)
19
count = getattr(session, 'count', 1)
20
session.count = count + 1
21
greeting = ["Welcome, person from ", request.client.host, "! You are using ",
22
request.getHeader('user-agent'), " and have been here ",
23
tags.span(id="count")[count], " times."]
24
return context.tag[greeting]
26
def child_reset(self, context):
27
inevow.ISession(context).count = 1
28
return '<html><body><span id="reset">Count reset</span></body></html>'