{ "info": { "author": "adrian ilarion ciobanu", "author_email": "cia@mud.ro", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.4", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Internet :: WWW/HTTP :: WSGI", "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "description\r\n===========\r\n\r\n*gadjo.requestprovider* gives access to django's HTTPRequest\r\nobject whenever is needed, without explicitly passing it down the path of\r\ncode.\r\n\r\n\r\nusage\r\n=====\r\n\r\nadd gadjo's requestprovider middleware to django's settings.py:\r\n\r\nMIDDLEWARE_CLASSES=(\r\n'gadjo.requestprovider.middleware.RequestProvider',\r\n...\r\n)\r\n\r\nWhenever you need the request object (from your model, form, etc):\r\n\r\nfrom gadjo.requestprovider.signals import get_request\r\n\r\nhttp_request = get_request()\r\n\r\n\r\nimplementation details\r\n======================\r\n\r\nbesides saving a reference to the current request, the RequestProvider\r\nmiddleware also registers itself as a receiver for whoever signals that it\r\nneeds the request object. \r\n\r\nwhenver a get_request() is issued, the middleware is called to process the\r\nsignal and returns the request object. \r\nthis works because the signals in django are processed synchronously. \r\nget_request() calls send() on the request_accessor SingleHandlerSignal(Signal)\r\nobject and returns the current request to the caller.\r\nA SingleHandlerSignal is a Signal that makes sure it will only register\r\nauthorized receivers. This is to make sure no one will register a handler\r\n(maybe by mistake) for a request_accessor signal since this is supposed to be\r\nhandled only by our RequestProvider middleware.\r\n\r\nclass SingleHandlerSignal(Signal):\r\n\r\n allowed_receiver='gadjo.requestprovider.middleware.RequestProvider'\r\n\r\n\r\nthe Signal's connect() method is overwritten to register only allowed\r\nreceivers.\r\n\r\n\r\n\r\nTODO\r\n====\r\nnothing\r\n\r\nNOTE\r\n====\r\nthis is not thread-safe. however, if you are running your django apps in a threaded environment I don't think you really know what you're doing.", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/malfaux/snakecheese/blob/master/eggs/django-contrib-requestprovider-1.0.1.tar.gz?raw=true", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/malfaux/snakecheese/tree/master/gadjolib", "keywords": "django contrib,request object provider", "license": "License :: OSI Approved :: BSD License", "maintainer": "", "maintainer_email": "", "name": "django-contrib-requestprovider", "package_url": "https://pypi.org/project/django-contrib-requestprovider/", "platform": "__all_django_supported__, !threaded", "project_url": "https://pypi.org/project/django-contrib-requestprovider/", "project_urls": { "Download": "https://github.com/malfaux/snakecheese/blob/master/eggs/django-contrib-requestprovider-1.0.1.tar.gz?raw=true", "Homepage": "https://github.com/malfaux/snakecheese/tree/master/gadjolib" }, "release_url": "https://pypi.org/project/django-contrib-requestprovider/1.0.1/", "requires_dist": null, "requires_python": null, "summary": "access django request object whenever you need it", "version": "1.0.1" }, "last_serial": 802901, "releases": { "1.0.1": [] }, "urls": [] }