File: README.rst

package info (click to toggle)
python-bottle-beaker 0.1.3-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 112 kB
  • sloc: python: 52; makefile: 3
file content (32 lines) | stat: -rw-r--r-- 674 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
=============
bottle-beaker
=============

Bottle plugin to session and caching library with WSGI Middleware


Example
-------

.. code-block:: python

    import bottle
    from bottle.ext import beaker

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

    app = beaker.middleware.SessionMiddleware(bottle.app(), session_opts)

    @bottle.route('/test')
    def test():
        s = bottle.request.environ.get('beaker.session')
        s['test'] = s.get('test',0) + 1
        s.save()
        return 'Test counter: %d' % s['test']

    bottle.run(app=app)