Skip to main content

Zope4 session implementation using Beaker

Project description

#Introduction

Products.BeakerZopeSessionManager is a replacement for the default Zope 4 session implementation. It uses Beaker as a backend (via collective.beaker) and adapts the Beaker session to provide the same interface as a normal Zope session.

Beaker is a better alternative to the default session implementation for several reasons:

  • The Zope session implementation does not perform well in high-write scenarios.
  • Beaker provides better flexibility in where session data is actually stored.
  • Beaker is used and maintained outside of the Zope ecosystem.

.. Note:: If you are developing a product that needs sessions but are not already using Zope sessions, you should probably just use collective.beaker directly. This product is meant for use with existing add-ons that already use Zope sessions (i.e. request.SESSION).

#Installation

Include the line <include package="collective.beaker" /> in yout site.zcml

Edit the file lib/python3.7/site-packages/Zope2/Startup/serve.py inside your virtual env.

Replace (line 200):

try:
    serve(app)`
except (SystemExit, KeyboardInterrupt) as e:

with:

try:
    from beaker.middleware import SessionMiddleware
    config = {
        'session.type': 'file',
        'session.auto': True,
        'session.save_accessed_time': True,
        'session.data_dir': '/tmp/sessions/data',
        'session.lock_dir': '/tmp/sessions/lock',
        'session.timeout': 28800
    }
    server(SessionMiddleware(app, config))
except (SystemExit, KeyboardInterrupt) as e:

For more info on how to configure your Beaker, please refer to Beaker documentation.

#Notes

  • Beaker does not automatically clean up old sessions, so you may want to set up a cron job to take care of this.

#Contributors

  • Gabriel Gisoldo [gabrielgisoldo]

.. include:: CHANGES.rst

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file Products.BeakerZopeSessionManager-1.0.tar.gz.

File metadata

  • Download URL: Products.BeakerZopeSessionManager-1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.2

File hashes

Hashes for Products.BeakerZopeSessionManager-1.0.tar.gz
Algorithm Hash digest
SHA256 4064294721f44c3f8d759cfabd3cc82d5e0c1bd8ad6ea77c3c8af1182377658a
MD5 ac08d71ddb8a0398af6fb2e97dbea948
BLAKE2b-256 9595887e353d79de055becb85d38f64d45df3aba0eb31276be15cc586b40b894

See more details on using hashes here.

File details

Details for the file Products.BeakerZopeSessionManager-1.0-py3-none-any.whl.

File metadata

  • Download URL: Products.BeakerZopeSessionManager-1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.2

File hashes

Hashes for Products.BeakerZopeSessionManager-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90d60e883545096874add13bc1f839d7c2ee5d7c8eee8f2dfc5b295e58cc7e75
MD5 86d54ee1402c6087bce065f0867772aa
BLAKE2b-256 d0bdaefe8b3ec5d1656369dbf08b151ab8389981d8e0d8d856d5fbcd989d2db8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page