possibly fixed the Redis problem, thanks Rastafarian
This commit is contained in:
@@ -13,7 +13,7 @@ from gluon import current
|
||||
from gluon.storage import Storage
|
||||
from gluon.contrib.redis_utils import acquire_lock, release_lock
|
||||
from gluon.contrib.redis_utils import register_release_lock
|
||||
from gluon._compat import to_bytes
|
||||
from gluon._compat import to_native
|
||||
|
||||
logger = logging.getLogger("web2py.session.redis")
|
||||
|
||||
@@ -182,11 +182,11 @@ class MockQuery(object):
|
||||
key = self.keyprefix + ':' + str(self.value)
|
||||
if self.with_lock:
|
||||
acquire_lock(self.db.r_server, key + ':lock', self.value, 2)
|
||||
rtn = self.db.r_server.hgetall(key)
|
||||
rtn = {to_native(k.decode): v for k, v in self.db.r_server.hgetall(key).items()}
|
||||
if rtn:
|
||||
if self.unique_key:
|
||||
# make sure the id and unique_key are correct
|
||||
if rtn['unique_key'] == self.unique_key:
|
||||
if rtn['unique_key'] == to_native(self.unique_key):
|
||||
rtn['update_record'] = self.update # update record support
|
||||
else:
|
||||
rtn = None
|
||||
|
||||
+4
-4
@@ -13,7 +13,7 @@ Contains the classes for the global used variables:
|
||||
|
||||
"""
|
||||
from gluon._compat import pickle, StringIO, copyreg, Cookie, urlparse, PY2, iteritems, to_unicode, to_native, \
|
||||
to_bytes, unicodeT, long, hashlib_md5, urllib_quote
|
||||
to_bytes, unicodeT, long, hashlib_md5, urllib_quote, to_native
|
||||
from gluon.storage import Storage, List
|
||||
from gluon.streamer import streamer, stream_file_or_304_or_206, DEFAULT_CHUNK_SIZE
|
||||
from gluon.contenttype import contenttype
|
||||
@@ -1055,7 +1055,7 @@ class Session(Storage):
|
||||
if record_id.isdigit() and long(record_id) > 0:
|
||||
new_unique_key = web2py_uuid()
|
||||
row = table(record_id)
|
||||
if row and row['unique_key'] == unique_key:
|
||||
if row and to_native(row['unique_key']) == to_native(unique_key):
|
||||
table._db(table.id == record_id).update(unique_key=new_unique_key)
|
||||
else:
|
||||
record_id = None
|
||||
@@ -1231,9 +1231,9 @@ class Session(Storage):
|
||||
|
||||
session_pickled = response.session_pickled or pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
|
||||
|
||||
dd = dict(locked=False,
|
||||
dd = dict(locked=0,
|
||||
client_ip=response.session_client,
|
||||
modified_datetime=request.now,
|
||||
modified_datetime=request.now.isostring(),
|
||||
session_data=session_pickled,
|
||||
unique_key=unique_key)
|
||||
if record_id:
|
||||
|
||||
+1
-1
Submodule gluon/packages/dal updated: bf2081247d...8e2305ed3e
Reference in New Issue
Block a user