So, I am using Django with the Google App Engine, and I have a urls.py file that redirects each URL to the corresponding method. Each of these methods is automatically passed a “request” as one of the arguments, which, in my opinion, is an HttpRequest object.
How to create this filled request object from my code? For example, if I am inside a method deep inside my code, I would like to access this request object without passing it to each function to make sure that it is available. Assuming urls.py calls the foo method, the way I'm doing it right now is:
foo(request):
This seems wrong, because I need to pass the request through functions that it doesn’t need, so that I have it in baz.
I would like to do something like:
foo(request):
i.e. Do not miss the request if I do not need it. However, executing the request = HttpRequest () returns an empty request object ... what I want is a fully populated version, for example, that is passed to each method called with urls.py.
I looked at the documentation for HttpRequest here: http://docs.djangoproject.com/en/dev/ref/request-response/ but did not see how to do this.
Any thoughts would be greatly appreciated.
Thanks Ryan
ryan
source share