For some reason my webpy app works with CherryPy (sessions get created
and I can retrieve variables), but fails to work on apache2. I tried
with WSGI and Fastcgi. All my pages work fine except when I have a
session.
It creates the session in the session folder I defined for the
diskstore, but seems to 'forget' the session in there. It doesn't seem
to retrieve the session.
If I use CherryPy my session works fine. I can log in. On FastCGI I
get redirected to my login page (normal behavior when logged_in is
false for the session).
This is some relevant code:
app = web.application(urls, globals())
session = web.session.Session(app, web.session.DiskStore('sessions'),
{'name':None,'uid':
0,'logged_in':False,'username':None,'password':None})
class login:
def __init__(self):
self.render = web.template.render('templates/')
self.auth = dbconnector.pywikiAuthVerifier()
def GET(self):
if session.logged_in != True:
return self.getLoginScreen()
else:
raise web.seeother('/account')
def POST(self):
webinput = web.input()
isGood =
self.auth.isCorrect(webinput.username,hasherTool.getSha512(webinput.password))
if isGood[0][0] == True:
session.logged_in = True
session.uid = isGood[0][1]
session.name = isGood[0][2]
session.username = isGood[0][3]
raise web.seeother('/account')
else:
return self.getLoginScreen()
def getLoginScreen(self):
login = formsub.SyssecForm(
web.form.Textbox('username'),
web.form.Password('password'),
web.form.Button('Login'),
)
return self.render.simple(login)
Has anyone experienced similar behavior before?
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.