These are chat archives for cherrypy/cherrypy

1st
Jan 2019
Michal Konvalinka
@dwich
Jan 01 22:04
Hi guys, what is the preferred way of storing data during the lifetime of a single request/response? I don't need to keep data between two requests using sessions. I just need a "request-safe" place where I can store data and this data is available during the lifetime of the single request only. As far as I tried, cherrypy.request.something is not the right place.
Sviatoslav Sydorenko
@webknjaz
Jan 01 22:05
Why not? cherrypy.request is a thread-local proxy
Michal Konvalinka
@dwich
Jan 01 22:14
I'm struggling with it a bit. If it's safe, then there's a bug in my code which I need to find... Same data is somehow available in other requests - in one browser on my laptop and in another one too.
Sviatoslav Sydorenko
@webknjaz
Jan 01 22:16
Share a minimum reproducible example and I'll take a look
Michal Konvalinka
@dwich
Jan 01 22:19
Thanks. By the time I tried that with simple CP example and it works. I'll try to locate it in my code and find a reason.
Sviatoslav Sydorenko
@webknjaz
Jan 01 22:23
:+1:
Michal Konvalinka
@dwich
Jan 01 22:40
OK, found it. Thanks for making me sure that it works as expected. I had error in my code in an object that wraps cherrypy.request. In some cases the data was stored not in cherrypy.request.something which is ephemeral but in my request_wrapper.something which was permanent.
Sviatoslav Sydorenko
@webknjaz
Jan 01 22:41
:+1: