bbangert / beaker

WSGI middleware for sessions and caching
https://beaker.readthedocs.org/
Other
517 stars 146 forks source link

KeyError: '_accessed_time' #180

Open iinov opened 5 years ago

iinov commented 5 years ago

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
amol- commented 5 years ago

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?

iinov commented 5 years ago

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 : patrick.pierre@iinov.com

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 commented 4 years ago

Here is a simple test:

BeakerTest.tar.gz

I hope it will help you for the test suite.

kotofos commented 3 years ago

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

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)