from ExamplePage import ExamplePage class CountVisits(ExamplePage): """Counting visits example.""" def writeContent(self): count = self.session().value('count', 0) + 1 self.session().setValue('count', count) plural = count > 1 and 's' or '' self.writeln('
Your session has expired.
') self.writeln("You've been here" ' %d ' ' time%s.
' % (count, plural)) self.writeln('This page records your visits using a session object.' ' Every time you reload or' ' revisit this page, the counter will increase.' ' If you close your browser, then your session will end and you' ' will see the counter go back to 1 on your next visit.
') self.writeln('Try hitting ' 'reload now.
')