{ "info": { "author": "Selwin Ong", "author_email": "selwin.ong@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "django-cached_authentication_middleware is a drop in replacement for\n``django.contrib.auth``'s built in ``AuthenticationMiddleware``. It tries to\npopulate ``request.user`` by fetching user data from cache before falling back\nto the database.\n\nInstallation\n------------\n\n|Build Status|\n\n\n* Install via pypi::\n\n pip install django-cached_authentication_middleware\n\n* Configure ``CACHES`` in django's ``settings.py``::\n\n CACHES = {\n 'default': {\n 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',\n 'LOCATION': '127.0.0.1:11211',\n 'TIMEOUT': 36000,\n }\n }\n\n* Replace ``django.contrib.auth.middleware.AuthenticationMiddleware`` with\n ``cached_auth.Middleware`` in ``settings.py``::\n\n MIDDLEWARE_CLASSES = (\n 'django.middleware.common.CommonMiddleware',\n 'django.contrib.sessions.middleware.SessionMiddleware',\n #'django.contrib.auth.middleware.AuthenticationMiddleware'\n 'cached_auth.Middleware',\n )\n\nAnd you're done!\n\nCached Auth Preprocessor\n------------------------\n\nSometimes you want to preprocess to ``User`` instance before storing\nit into cache. ``cached_auth`` allows you to define\n``settings.CACHED_AUTH_PREPROCESSOR``, a callable that takes two arguments, ``user`` & ``request`` and returns a ``User`` instance.\n\nA classic example of this would be to attach ``Profile`` data\nto ``User`` object so calling ``request.user.profile`` does not incur a\ndatabase hit. Here's how we can implement it.\n\n.. code-block:: python\n\n def attach_profile(user, request):\n try:\n user.get_profile()\n # Handle exception for user with no profile and AnonymousUser\n except (Profile.DoesNotExist, AttributeError):\n pass\n return user\n\n\n # In settings.py:\n CACHED_AUTH_PREPROCESSOR = 'path.to.module.attach_profile'\n\nRunning Tests\n-------------\n\nTo run the test suite::\n\n python tests/runtests.py\n\nTo run the test suite with Django custom user (this will run only on Django 1.5)::\n\n python tests/runtests_custom_user.py\n\nChangelog\n---------\n\nVersion 0.2.2 (2017-04-29)\n==================\n* Added compatibility with Django 1.11. Thanks @ondrejsika!\n\nVersion 0.2.1\n=============\n* Better Django 1.8 compatibility.\n\nVersion 0.2.0\n=============\n\n* Added support for Django 1.5's customer user model\n* Added ``CACHED_AUTH_PREPROCESSOR`` setting\n\nVersion 0.1.1\n=============\n\n* Fixed an error where middleware tries to call \"get_profile\" on AnonymousUser\n\nVersion 0.1\n===========\n\n* Initial release\n\n\n.. |Build Status| image:: https://travis-ci.org/ui/django-cached_authentication_middleware.png?branch=master\n :target: https://travis-ci.org/ui/django-cached_authentication_middleware", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ui/django-cached_authentication_middleware", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-cached_authentication_middleware", "package_url": "https://pypi.org/project/django-cached_authentication_middleware/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-cached_authentication_middleware/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/ui/django-cached_authentication_middleware" }, "release_url": "https://pypi.org/project/django-cached_authentication_middleware/0.2.2/", "requires_dist": null, "requires_python": null, "summary": "A drop in replacement for django's built in AuthenticationMiddleware that utilizes caching.", "version": "0.2.2" }, "last_serial": 2838736, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3a5a8653d016b71609b6d82952ecd0e3", "sha256": "7eacad5b411dd9c5141f0f043a5f9838e3b110055ed17d37d380e763e0c7609d" }, "downloads": -1, "filename": "django-cached_authentication_middleware-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3a5a8653d016b71609b6d82952ecd0e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3523, "upload_time": "2012-09-06T09:43:08", "url": "https://files.pythonhosted.org/packages/32/5e/d49b0cb3ab49b6fc228649a8f3d0bcb38623b723c508355e3f45d406854d/django-cached_authentication_middleware-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a0157c5e3700019d77f320f2f01394c5", "sha256": "cc01d37453d6b0ec3099c4de6563fa21987bc2e4ef1cac73fae738996f0f08d6" }, "downloads": -1, "filename": "django-cached_authentication_middleware-0.1.1.tar.gz", "has_sig": false, "md5_digest": "a0157c5e3700019d77f320f2f01394c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3601, "upload_time": "2012-09-07T04:35:07", "url": "https://files.pythonhosted.org/packages/9b/b1/aa0d1c577def1a07c302e5c40676f20881061fd7841e05c1ac636aea4c59/django-cached_authentication_middleware-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "882c86ab0afac86d4f3a12b691f812e5", "sha256": "3db4140c7cfd9d7ae65039d4682907a17bddb53fcd69a7ff7c2afd0e29c12367" }, "downloads": -1, "filename": "django-cached_authentication_middleware-0.2.0.tar.gz", "has_sig": false, "md5_digest": "882c86ab0afac86d4f3a12b691f812e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4727, "upload_time": "2013-04-19T09:05:13", "url": "https://files.pythonhosted.org/packages/54/00/7b0ca1c3230fb6c91057001ca9b8e9848eaf8d99fefee798e74590b6213e/django-cached_authentication_middleware-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "731ea44b7f497bc86c1c5aa03946452f", "sha256": "6d2546f562d074f1e73246a9cd24302700d81373ab9e1ec8035d2ff5ec81e15d" }, "downloads": -1, "filename": "django_cached_authentication_middleware-0.2.1-py2-none-any.whl", "has_sig": false, "md5_digest": "731ea44b7f497bc86c1c5aa03946452f", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6321, "upload_time": "2015-06-03T10:25:36", "url": "https://files.pythonhosted.org/packages/1e/74/b00448f2ec5cee5033fcf5f18552ef72232b9574b19743b0e69aa115afee/django_cached_authentication_middleware-0.2.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5807f5965114a3573a441d87c30511c6", "sha256": "7b71ec566b2a2d2666dfe62d2d404c194b1b15ab01103dd766895c30b0a3774c" }, "downloads": -1, "filename": "django-cached_authentication_middleware-0.2.1.tar.gz", "has_sig": false, "md5_digest": "5807f5965114a3573a441d87c30511c6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4434, "upload_time": "2015-06-03T10:25:32", "url": "https://files.pythonhosted.org/packages/83/2c/dd829201c3f57b650325b0f7b72c59333eee903a9776fba272c022e99640/django-cached_authentication_middleware-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "f519f55634433f9ece8a09fcaf0debe2", "sha256": "fc10fb2859d1f3245f22dec4b24a0e41520639783e24bbcb77d19d33ee3079f5" }, "downloads": -1, "filename": "django_cached_authentication_middleware-0.2.2-py2-none-any.whl", "has_sig": false, "md5_digest": "f519f55634433f9ece8a09fcaf0debe2", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6552, "upload_time": "2017-04-29T03:55:58", "url": "https://files.pythonhosted.org/packages/d6/8f/43e23b6f2608ee5967fca887735048f4275a6bf2d75dc094835232a19aff/django_cached_authentication_middleware-0.2.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "507c1d57bf8ac6f2b3fd1e6f373c4c66", "sha256": "bdf664b211256391ba0b57783c78123183d35e62caef18913e892b190103dc51" }, "downloads": -1, "filename": "django-cached_authentication_middleware-0.2.2.tar.gz", "has_sig": false, "md5_digest": "507c1d57bf8ac6f2b3fd1e6f373c4c66", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4649, "upload_time": "2017-04-29T03:55:55", "url": "https://files.pythonhosted.org/packages/f1/22/090054809937f6a4e47293fe17a4c6d65056a40f3fcfdda885f4720482e7/django-cached_authentication_middleware-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f519f55634433f9ece8a09fcaf0debe2", "sha256": "fc10fb2859d1f3245f22dec4b24a0e41520639783e24bbcb77d19d33ee3079f5" }, "downloads": -1, "filename": "django_cached_authentication_middleware-0.2.2-py2-none-any.whl", "has_sig": false, "md5_digest": "f519f55634433f9ece8a09fcaf0debe2", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6552, "upload_time": "2017-04-29T03:55:58", "url": "https://files.pythonhosted.org/packages/d6/8f/43e23b6f2608ee5967fca887735048f4275a6bf2d75dc094835232a19aff/django_cached_authentication_middleware-0.2.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "507c1d57bf8ac6f2b3fd1e6f373c4c66", "sha256": "bdf664b211256391ba0b57783c78123183d35e62caef18913e892b190103dc51" }, "downloads": -1, "filename": "django-cached_authentication_middleware-0.2.2.tar.gz", "has_sig": false, "md5_digest": "507c1d57bf8ac6f2b3fd1e6f373c4c66", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4649, "upload_time": "2017-04-29T03:55:55", "url": "https://files.pythonhosted.org/packages/f1/22/090054809937f6a4e47293fe17a4c6d65056a40f3fcfdda885f4720482e7/django-cached_authentication_middleware-0.2.2.tar.gz" } ] }