close Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Version 2 (modified by cmlenz, 12 years ago) (diff)

Added session usage example

Session State

The diva.session module implements management of session state, based entirely on client-side storage via HTTP cookies.



When the session filter is enabled (which is the default), a plain Python dict is made available as the application context variable app.ctxt.session. It should usually not be necessary to access that dictionary directly, as the diva.session module provides a couple of module-level functions to read, write and delete session data.

For example, a simple request handler accessing the session might look like this:

from diva import session
from diva.templating import output, render

def test(request, response):
    cnt = session.get('counter', 0) + 1
    session.set('counter', cnt)
    return render(counter=cnt)

API Documentation

Error: Macro PythonDoc(trunk, diva.session) failed
Unsupported version control system "svn": No module named svn