Skip to main content

UNKNOWN

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.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

muffin_session-0.0.1-cp34-cp34m-macosx_10_10_x86_64.whl (4.0 kB view details)

Uploaded CPython 3.4m macOS 10.10+ x86-64

File details

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

File metadata

File hashes

Hashes for muffin-session-0.0.1.tar.gz
Algorithm Hash digest
SHA256 588d5c70c7da31454ce46565a7262063827345042f0a87fff1775ae89bdd26ff
MD5 d0202b16effbd53d6b0e4847d6870f41
BLAKE2b-256 a4a663e7c0d16f9dd2ae977c57b8b4fa4054fa39128222f7d0ccd647bdf19dc3

See more details on using hashes here.

File details

Details for the file muffin_session-0.0.1-cp34-cp34m-macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for muffin_session-0.0.1-cp34-cp34m-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 65e148b687e4e854b0ac32964380fa64370fdcd698f22182f93a434b818928c5
MD5 dd0cd1587ef259897f13c4732ccf6eca
BLAKE2b-256 cbbba65643bffb7567f5469e4dde292753509a371802650b93427ad75d40caba

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