beaker icon indicating copy to clipboard operation
beaker copied to clipboard

KeyError: '_accessed_time'

Open iinov opened this issue 4 years ago • 4 comments

Hi,

I use Beaker as a session manager for a Pyramid project. With the 1.11.0 release, if I clear a session, I have the following error:

virtualenv/site-packages/beaker/session.py", line 465, in load '_accessed_time' in session_data and
KeyError: '_accessed_time'

I suggest to fix it like this:

        if self.timeout is not None and \
           '_accessed_time' in session_data and \
           now - session_data['_accessed_time'] > self.timeout:
            timed_out = True

iinov avatar Sep 01 '19 07:09 iinov

Thanks for the report! Are you able to provide a simple test to reproduce the issue so that I can make it part of the test suite?

amol- avatar Sep 01 '19 19:09 amol-

Alessandro,

A simple test, for the time being, not really. But, I can work on it.

Patrick

iinov – 12 avenue de l'Opéra – 75001 Paris Mail : [email protected]

Le 01/09/2019 à 21:17, Alessandro Molina a écrit :

Thanks for the report! Are you able to provide a simple test to reproduce the issue so that I can make it part of the test suite?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bbangert/beaker/issues/180?email_source=notifications&email_token=AHIFG2WQPY3RXQJHVPAN6ADQHQIMLA5CNFSM4ISV7KYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5UI3SA#issuecomment-526945736, or mute the thread https://github.com/notifications/unsubscribe-auth/AHIFG2WIBYTQACK5Y7YV3WDQHQIMLANCNFSM4ISV7KYA.

iinov avatar Sep 02 '19 15:09 iinov

Here is a simple test:

BeakerTest.tar.gz

I hope it will help you for the test suite.

iinov avatar Oct 06 '19 15:10 iinov

Have the same issue. I see the next steps to reproduce in pyramid app:

  • Use persistent storage for sessions, set session.timeout
  • login
  • save received cookie
  • logout
  • send request with saved cookie value

Or in python:

from beaker.session import Session

COOKIE_REQUEST = {}
# login
session = Session(COOKIE_REQUEST, timeout=1)

saved_cookie = COOKIE_REQUEST['cookie_out']

# logout
session.delete()
session.save()


COOKIE_REQUEST['cookie'] = saved_cookie
Session(COOKIE_REQUEST, timeout=1)

kotofos avatar Sep 24 '20 08:09 kotofos