Skip to main content

No project description provided

Project description

Muffin-Session – Implement an user sessions in Muffin Framework.

Build Status http://img.shields.io/pypi/v/muffin-session.svg?style=flat-square http://img.shields.io/pypi/dm/muffin-session.svg?style=flat-square Donate

Requirements

  • python >= 3.3

Installation

Muffin-Session should be installed using pip:

pip install muffin-session

Usage

Add muffin_peewee to PLUGINS in your Muffin Application configuration.

Options

SESSION_DEFAULT_USER_CHECKER – A function which checks logged user (lambda x: x) SESSION_LOGIN_URL – Redirect URL (‘/login’) SESSION_SECRET – A secret code (‘Insecuresecret’)

Views

@app.ps.session.user_loader
def load_user(_id):
    """Define your own user loader. """


@app.register('/admin')
@app.ps.session.user_pass(lambda u: u.is_admin)
def admin(request):
    """ Check for user is admin. """


@app.register('/login')
def login(request):
    """ Login user. """
    # ...
    yield from app.ps.session.login(curuser.pk)


@app.register('/logout')
    """ Logout user. """
    # ...
    yield from app.ps.session.logout(curuser.pk)

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/muffin-session/issues

Contributing

Development of Muffin-Session happens at: https://github.com/klen/muffin-session

Contributors

  • klen (Kirill Klenov)

License

Licensed under a MIT license.

Project details


Download files

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

Source Distribution

muffin-session-0.0.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

muffin_session-0.0.2-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file muffin-session-0.0.2.tar.gz.

File metadata

File hashes

Hashes for muffin-session-0.0.2.tar.gz
Algorithm Hash digest
SHA256 637ec5943aef322e8cb5a0c9e440f283f6dc0384d98255ea6cb3957b7bfce1e9
MD5 8aa79b6525801cf52e4d5fdbedaf5dfc
BLAKE2b-256 3d5d2c6a826ea2d6eae1183564ce81aab188091f5fa222641f65ecc630058bd5

See more details on using hashes here.

File details

Details for the file muffin_session-0.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for muffin_session-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cbaa1ecff31760f22b114eb537634022e012c050740ec407d2044a3fb2f1b393
MD5 65c068ec7284d110cf8a1a0c9afa663c
BLAKE2b-256 f52fdd81b164d0a842b93f57420d18fa82e7f39b6050fe8c08c0f7e117d2da40

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