Skip to main content

Add the user object to Django threadlocals

Project description

Introduction
============

Provides a simple middleware and API to get hold of the currently
logged-in user.

Usage
=====

Simply add fez.djangothreadlocal.middleware.threadlocals.ThreadLocals
to your MIDDLEWARE_CLASSES in settings.py, for example:

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'fez.djangothreadlocal.middleware.threadlocals.ThreadLocals',
)

You should then be able to get hold of the current logged-in
user (or anonymous user) as follows:

from fez.djangothreadlocal.middleware import threadlocals
user = threadlocals.get_current_user()
Changelog
=========

0.3 - Initial release
---------------------

* Initial release

Project details


Release history Release notifications | RSS feed

This version

0.3

Download files

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

Files for fez.djangothreadlocal, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size fez.djangothreadlocal-0.3.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page