Skip to content

How can i update expire time per call or refresh page #233

Description

@rikhtehgaran

Hi I have been using the beaker in Bottle framework but I don't know how to update the session cookie expiration time in a beaker
it's my code. I need to update the expiration time in the test method when called

import bottle
from beaker.middleware import SessionMiddleware

session_opts = {
    'session.type': 'file',
    'session.cookie_expires': 300,
    'session.data_dir': './data',
    'session.auto': True,

}
app = bottle.Bottle()
subapp = SessionMiddleware(app, session_opts,environ_key="myapp")

@app.route('/test')
def test():
  s = bottle.request.environ.get('myapp')
  subapp.options={'session.cookie_expires': 300}
  s['test'] = s.get('test',0) + 1
  s.save()
  return 'Test counter: %d' % s['test']

bottle.run(app=subapp, port=8000)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions