Little fix in sessions
This commit is contained in:
parent
e853124bf2
commit
52d5e3e133
1 changed files with 27 additions and 22 deletions
|
|
@ -109,32 +109,37 @@ def regenerate_session():
|
||||||
def get_session():
|
def get_session():
|
||||||
|
|
||||||
s={}
|
s={}
|
||||||
|
|
||||||
if request.environ:
|
try:
|
||||||
|
|
||||||
if not 'session' in request.environ:
|
if request.environ:
|
||||||
|
|
||||||
cookie=None
|
if not 'session' in request.environ:
|
||||||
|
|
||||||
if request.cookies.get(config.cookie_name):
|
|
||||||
cookie=request.get_cookie(config.cookie_name)
|
|
||||||
|
|
||||||
if not cookie:
|
|
||||||
|
|
||||||
s=generate_session()
|
cookie=None
|
||||||
|
|
||||||
|
if request.cookies.get(config.cookie_name):
|
||||||
|
cookie=request.get_cookie(config.cookie_name)
|
||||||
|
|
||||||
|
if not cookie:
|
||||||
|
|
||||||
|
s=generate_session()
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
# Here get the function for load session
|
||||||
|
|
||||||
|
s=load_session(cookie)
|
||||||
|
|
||||||
|
request.environ['session']=s
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
# Here get the function for load session
|
s=request.environ['session']
|
||||||
|
except RuntimeError:
|
||||||
s=load_session(cookie)
|
|
||||||
|
pass
|
||||||
request.environ['session']=s
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
|
||||||
|
|
||||||
s=request.environ['session']
|
|
||||||
|
|
||||||
return ParamecioSession(s)
|
return ParamecioSession(s)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue