Search code examples
pythonpyramidbeaker

How do I override the default session timeout with pyramid + pyramid-beaker + beaker


I am using pyramid to create a web application. I am then using pyramid-beaker to interface beaker into pyramid's session management system.

Two values affect the duration of a user's session.

  1. The session cookie timeout
  2. The actual session's life time on either disk/memcache/rdbms/etc

I currently have to cookie defaulted (via the standard beaker config) to delete when the browser closes. I have the session data set to clear out after 2 hours. This works prefectly.

What I need to know is how to override the cookie's timeout and the session timeout to both be 30 days or some other arbirtrary value.


Solution

  • Changing the timeout isn't supported by beaker. If you are trying to make a session stick around that long, you should probably just put it into a separate cookie. A common use-case is the "remember me" checkbox on login. This helps you track who the user is, but generally the actual session shouldn't be sticking around that long and gets recreated.