How to use beaker session in bottle micro framework?
Asked Answered
U

1

4

When I try to assign something to the session dictionary using beaker, I get the following error:

Traceback (most recent call last):
    rv = callback(*a, **ka)
  File "controllers.py", line 30, in login
    s['email'] = email
TypeError: 'NoneType' object does not support item assignment
1.0.0.127.in-addr.arpa - - [12/Feb/2012 18:48:52] "POST /login HTTP/1.1" 500 746

where

s = bottle.request.environ.get('beaker.session')

I follow the tutorial at the bottle FAQ.

Undersecretary answered 12/2, 2012 at 10:55 Comment(1)
Did you follow this app = SessionMiddleware(app, session_opts)?Fulgor
G
6
session_opts = {
    'session.type': 'file',
    'session.cookie_expires': 300,
    'session.data_dir': './data',
    'session.auto': True
}
myapp = SessionMiddleware(app, session_opts)
run(app=myapp)
Goldoni answered 23/2, 2012 at 1:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.