BUG response.cookies and sessions2trash.py

22 views
Skip to first unread message

Annet

unread,
Feb 27, 2020, 12:55:16 PM2/27/20
to web2py-users
I scheduled cron to regularly trash the session in my web2py applications. this worked well
until I added this line of code to a model.py file;

response.cookies[response.session_id_name]['domain'] = '.leonexus.nl'

My scripts log any errors at ~my/logs/user/sessions2trash.log.
That file is full of lines like:

Traceback (most recent call last):
  File "/home/my/webapps/web2py/web2py/gluon/restricted.py", line 227, in restricted
    exec ccode in environment
  File "applications/init/models/00_init_db.py", line 6, in <module>
    response.cookies[response.session_id_name]['domain'] = '.mydomain.com'
KeyError: None

I know in python a KeyError is raised when a dictionary is accessed but the key requested is not in it.
However, I have no idea why the line of code interferes with calling /scripts/sessions2trash.py

I am working with web2py 2.14.5 and python 2.7
Hope someone can help me solve the issue.


Kind regards,

Annet
Reply all
Reply to author
Forward
0 new messages