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
Hope someone can help me solve the issue.