Is it time to take redis off the features list?

55 views
Skip to first unread message

Joe Barnhart

unread,
Nov 12, 2020, 10:13:18 PM11/12/20
to web2py-users
I know this is really old news, but redis no longer works under python 3 and web2py.  I'm just thinking it's time to take out all mention of redis from the book and list of features of web2py.  Yes, it technically works with python 2, but since that platform is now dropped in the wake of the good ship SS Python, it's time to either bite the bullet and fix the feature or deleted it entirely from the website, book, and promotion of web2py.

Jose C

unread,
Nov 13, 2020, 5:25:13 AM11/13/20
to web2py-users
I have it working with python3 but only as far as web2py 2.18.5.  Thereafter I cannot get it to work either.

Unfortunately it does begin to appear that web2py has reached end of life status.

Joe Barnhart

unread,
Jan 1, 2021, 6:39:37 PM1/1/21
to web2py-users
I think I found a workaround for redis3 sessions.  Here is a mod that works for me:

diff --git a/gluon/contrib/redis_session.py b/gluon/contrib/redis_session.py
index 6413b52a..73c20422 100644
--- a/gluon/contrib/redis_session.py
+++ b/gluon/contrib/redis_session.py
@@ -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_native
+from gluon._compat import to_native,to_bytes
 from datetime import datetime
 
 logger = logging.getLogger("web2py.session.redis")
@@ -208,7 +208,7 @@ class MockQuery(object):
             if rtn:
                 if self.unique_key:
                     # make sure the id and unique_key are correct
-                    if rtn['unique_key'] == to_native(self.unique_key):
+                    if rtn['unique_key'] == to_bytes(self.unique_key):
                         rtn['update_record'] = self.update  # update record support
                     else:
                         rtn = None


Reply all
Reply to author
Forward
0 new messages