I using,
if web.config.get('_session') is None:
print("NEW SESSION !")
session = web.session.Session(app, web.session.DiskStore('sessions'),
{'count': 0})
web.config._session = session
else:
session = web.config._session
I could see that he lost between requests data from the web.config and
create new session !
Using python 2.73 and mod_wsgi 3.3.
not yet worked = (
[Thu Jun 07 10:30:20 2012] [warn] mod_wsgi: Compiled for
Python/2.7.2.<http://2.7.0.2/>
[Thu Jun 07 10:30:20 2012] [warn] mod_wsgi: Runtime Python/2.7.3 using.
this could be the problem?
2012/6/6 Leandro Severino <[email protected]>
> Hi Mauro,
>
> I'm from pt_br too.
>
> Try this:
>
> ps: Sorry by my dirt code !.
>
> [ my code.py ]
>
> webapp = web.application(urls, globals())
> session = web.session.Session(webapp,
> web.session.DiskStore('sessions'), initializer={'captcha': 0,
> 'isAdmin':0, 'admin_user': ''})
>
> def session_hook():
> web.ctx.session = session
>
> webapp.add_processor(web.loadhook(session_hook))
>
>
> [ my admin.py ]
>
> class Login(object):
> def GET(self):
> return render.layout(render.login(**d))
>
> def POST(self):
> i = web.input()
> try:
> if i.username and i.password:
> logado = model.login(i.username, i.password)
> if logado.login:
> if logado.nivel_acesso == 1:
> web.ctx.session.isAdmin = 1
> else:
> web.ctx.session.isAdmin = logado.nivel_acesso
> web.ctx.session.admin_user = logado.login
> web.ctx.session.logged=logado
> raise web.seeother('/')
> else:
> d['error'] = "Usuário ou Senha inválidos!"
> except:
> d['error'] = "Usuário ou Senha inválidos!"
> return render.layout(render.login(**d))
>
> --
> 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.
>
>
--
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.