Support "session cookies" which flush on browser close

guest avatarguest created an issue

In order to expire session cookies on browser close, it was suggested to use `tools.sessions.timeout: None`. However this produces a server fault.

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/cherrypy/_cprequest.py", line 609, in respond
    self.hooks.run('before_finalize')
  File "/usr/lib/python2.5/site-packages/cherrypy/_cprequest.py", line 98, in run
    hook()
  File "/usr/lib/python2.5/site-packages/cherrypy/_cprequest.py", line 58, in __call__
    return self.callback(**self.kwargs)
  File "/usr/lib/python2.5/site-packages/cherrypy/lib/sessions.py", line 565, in save
    cherrypy.session.save()
  File "/usr/lib/python2.5/site-packages/cherrypy/lib/sessions.py", line 123, in save
    t = datetime.timedelta(seconds = self.timeout * 60)
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'

Comments (2)

  1. Robert Brewer

    Fixed in [2062] via a new `tools.sessions.persistent` arg; default is True--set to False to retain a timeout on session storage but omit the `expires` param in the cookie.

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.