Metadata-Version: 1.1 Name: django-crequest Version: 2018.5.11 Summary: Middleware that makes the current request available from anywhere. Home-page: https://github.com/Alir3z4/django-crequest Author: Alireza Savand Author-email: alireza.savand@gmail.com License: Copyright (c) 2012-2018 Alireza Savand All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the authors nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Description-Content-Type: UNKNOWN Description: =============== django-crequest =============== .. contents:: Overview ======== - ``crequest`` takes care of current ``request`` in silent way. - ``crequest`` will bring you current ``request`` object of your Django application from anywhere in your code. Installing ========== ``django-crequest`` is available on http://pypi.python.org/pypi/django-crequest So it can be installed it by pip:: $ python pip install django-crequest Or you can grab the latest version tarball and :: $ python setup.py install To enable ``django-crequest`` in your project * Add ``crequest`` to *INSTALLED_APPS* in your **settings.py** * Add ``crequest.middleware.CrequestMiddleware`` to ``MIDDLEWARE_CLASSES`` after the authentication and session middleware. Supported Python versions ========================= ``django-crequest`` currently can be run on multiple python versions: * Python 2 * Python 3 * PyPy How to use ========== First import the crequest's middleware:: from crequest.middleware import CrequestMiddleware Get the current ``request`` ;):: current_request = CrequestMiddleware.get_request() Done. In depth & Complex details ========================== Set the current request in UnKnown situations:: CrequestMiddleware.set_request(request) Return *iam_request* if there is no current request:: CrequestMiddleware.get_request(iam_request) And finally delete:: CrequestMiddleware.del_request() The middleware automatically sets/deletes the current request for HTTP requests. For other uses (management commands, scripts), you will need to do this yourself. Keywords: django,request,web Platform: OS Independent Classifier: Development Status :: 5 - Production/Stable Classifier: Development Status :: 6 - Mature Classifier: Environment :: Web Environment Classifier: Framework :: Django Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.0 Classifier: Programming Language :: Python :: 3.1 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Topic :: Software Development Classifier: Topic :: Software Development :: Libraries Provides: crequest