fixing more bugs in new session handling

This commit is contained in:
mdipierro
2013-08-22 04:32:47 -05:00
committed by Michele Comitini
parent 21b1b0fa48
commit 24c9f999e1
2 changed files with 13 additions and 6 deletions

View File

@@ -1 +1 @@
Version 2.6.0-development+timestamp.2013.08.22.03.46.07
Version 2.6.0-development+timestamp.2013.08.22.04.31.40

View File

@@ -889,11 +889,14 @@ class Session(Storage):
if record_id.isdigit() and long(record_id)>1:
new_unique_key = web2py_uuid()
rows = db(table.id==record_id)(table.unique_key==unique_key)\
.update(unique_key=new_unique_key)
row = table(record_id)
if row and row.unique_key==unique_key:
row.update_record(unique_key=new_unique_key)
else:
row = None
else:
rows = None
if rows:
row = None
if row:
response.session_id = '%s:%s' % (record_id, unique_key)
response.session_db_record_id = record_id
response.session_db_unique_key = new_unique_key
@@ -1008,7 +1011,11 @@ class Session(Storage):
session_data=cPickle.dumps(dict(self)),
unique_key=unique_key)
if record_id:
table(record_id).update_record(**dd)
row = table(record_id)
if row:
row.update_record(**dd)
else:
record_id
if not record_id:
record_id = table.insert(**dd)
response.session_id = '%s:%s' % (record_id, unique_key)