title: Beaker as session middleware
body: <p>I'm writing an app using bottle.py and <code>beaker.middleware.SessionMiddleware</code>:</p>
  
  <p>How can I modify the <code>session.timeout</code> and <code>session.cookie_expires</code> values so I can implement a login system that logs the user in for 30 days?</p>
  
  <p>I already implemented the standard login system so everything works until the browser closes, but I'd like to modify those values if the user checks the <em>Remember me</em> checkbox.</p>
  
  <p>I thought of two variants if the user checks the <em>Remember me</em> checkbox:</p>
  
  <ul>
  <li><p>Set <code>session.cookie_expires</code> and <code>session.timeout</code> to 30 days, but it seems that I can't modify these values at run-time because the cookie I recieve expires at the end of the browser session, ignoring my runtime modifications.</p></li>
  <li><p>Set <code>session.timeout</code> to 30 days and overwrite the cookie named <code>beaker.session.id</code> writing the same session id but different expiry date.
  But the run-time problem from point 1. remains and it seems that I can't access the session's id that I just created with beaker, so I don't know what to store in the cookie.</p></li>
  </ul>
  
  <p>How can I implement this?</p>