PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/web/sessions.py

https://bitbucket.org/prologic/circuits/
Python | 17 lines | 11 code | 5 blank | 1 comment | 2 complexity | 3d8363ea219e03dcd4bdcc43c802c4c4 MD5 | raw file
 1#!/usr/bin/env python
 2
 3from circuits.web import Server, Controller, Sessions
 4
 5
 6class Root(Controller):
 7
 8    def index(self, name="World"):
 9        if "name" in self.session:
10            name = self.session["name"]
11        self.session["name"] = name
12        return "Hello %s!" % name
13
14app = Server(("0.0.0.0", 8000))
15Sessions().register(app)
16Root().register(app)
17app.run()