Skip to content

Commit

Permalink
Merge pull request #41 from samkaufman/master
Browse files Browse the repository at this point in the history
Extension to doc for 0.3/sessions
  • Loading branch information
aaronsw committed Sep 28, 2012
2 parents 480c25f + cefdc88 commit 5ab2b05
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/0.3/sessions.md
Expand Up @@ -60,4 +60,15 @@ The following code shows how to use a basic DiskStore session.




if __name__ == '__main__': if __name__ == '__main__':
app.run() app.run()


## Sessions and Reloading/Debug Mode
Is your session data disappearing for seemingly no reason? This can happen when using the web.py app reloader (local debug mode), which will not persist the session object between reloads. Here's a nifty hack to get around this.

# Hack to make session play nice with the reloader (in debug mode)
if web.config.get('_session') is None:
session = web.session.Session(app, db.SessionDBStore())
web.config._session = session
else:
session = web.config._session

0 comments on commit 5ab2b05

Please sign in to comment.