1

I'm using beakers WSGI SessionMiddleware to manage a session between browser and application. I am trying to differentiate between when a session is first accessed against any further requests.

Fom the docs it appears there are two useful values made available in the WSGI environment, ["beaker.session"].last_accessed and ["beaker.session"]["_accessed_time"]

However, on repeated requests ["beaker.session"].last_accessed is always returning None, while the timestamp value in ["beaker.session"]["_accessed_time"] can be seen to be increasing with each request.

Each request performs a ["beaker.session"].save() - I have tried various combinations of setting auto=True in the session, and using .save() / .persist(), but no joy : .last_accessed is always None.

I am not using the session to actually persist any data, only to manage the creation of and pass through the session.id. ( I am using a session type of 'cookie' )

Chris Seymour
  • 83,387
  • 30
  • 160
  • 202
Matt Warren
  • 669
  • 8
  • 18

1 Answers1

1

It turns out this behaviour is down to multiprocessing via apache.

It was resolved by using an external store to manage tracking when the session ID is first seen, and maintaining my own 'last_accessed_time' etc.

Matt Warren
  • 669
  • 8
  • 18