This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!
Project Description


gadjo.requestprovider gives access to django’s HTTPRequest object whenever is needed, without explicitly passing it down the path of code.


add gadjo’s requestprovider middleware to django’s

MIDDLEWARE_CLASSES=( ‘gadjo.requestprovider.middleware.RequestProvider’, … )

Whenever you need the request object (from your model, form, etc):

from gadjo.requestprovider.signals import get_request

http_request = get_request()

implementation details

besides saving a reference to the current request, the RequestProvider middleware also registers itself as a receiver for whoever signals that it needs the request object.

whenver a get_request() is issued, the middleware is called to process the signal and returns the request object. this works because the signals in django are processed synchronously. get_request() calls send() on the request_accessor SingleHandlerSignal(Signal) object and returns the current request to the caller. A SingleHandlerSignal is a Signal that makes sure it will only register authorized receivers. This is to make sure no one will register a handler (maybe by mistake) for a request_accessor signal since this is supposed to be handled only by our RequestProvider middleware.

class SingleHandlerSignal(Signal):


the Signal’s connect() method is overwritten to register only allowed receivers.




this 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.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting