Skip to content

Store bytes in memcached session, but always return native strings#1476

Merged
webknjaz merged 5 commits into
cherrypy:masterfrom
webknjaz:bugfix/1453-memcached-bytes
Aug 27, 2016
Merged

Store bytes in memcached session, but always return native strings#1476
webknjaz merged 5 commits into
cherrypy:masterfrom
webknjaz:bugfix/1453-memcached-bytes

Conversation

@webknjaz
Copy link
Copy Markdown
Member

Fix #1453

@jaraco
Copy link
Copy Markdown
Member

jaraco commented Aug 21, 2016

ntob and tonative are deprecated constructs, so probably shouldn't be used here. An the very least, I think the change to _set_id is no better than the implementation that's in place now. Why ensure it's unicode just to convert it to bytes?

I can see the value in the change to _get_id as it provides backward compatibility for older versions of python-memcached on Python 2.

Personally, I'd be inclined to drop support for older versions of python-memcachd, and remove all of this workaround code altogether. What do you think?

@webknjaz
Copy link
Copy Markdown
Member Author

Well, I think to do so we need to add dependency restriction.
I suggest adding extras to setup.py.
It would be useful for end-users as well. If they want to use memcached backed sessions they'll just specify (e.g.) cherrypy[memcached-sessions] and won't need to track memcached client version themselves.

@webknjaz
Copy link
Copy Markdown
Member Author

@jaraco I think now it's OK to merge it

@jaraco
Copy link
Copy Markdown
Member

jaraco commented Aug 27, 2016

Looks good to me. Can you add a CHANGES.rst entry as well?

@webknjaz
Copy link
Copy Markdown
Member Author

Sure, done. Merging PR :)

@webknjaz webknjaz merged commit ce79280 into cherrypy:master Aug 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants