Делать было нечего, дело было вечером... В)
Простенький пример:
from beaker.session import SessionMiddleware
import web
from web import form
log_in = form.Form(
form.Textbox("login", form.notnull, description="User name"),
form.Password("password", form.notnull, description="Password")
)
def logged(session):
if "logeddin" in session:
if session["logeddin"] == 1:
return True
return False
urls = (
'/', 'index',
'/logout', 'logout',)
users = {"sl": "123"}
class index:
def GET(self):
web.header("Content-Type","text/html; charset=utf-8")
session = web.ctx.environ['beaker.session']
if logged(session):
print "U logged as %s"%session["username"]
print " logout"
else:
print "