jedie / django-tools

miscellaneous django tools
http://pypi.python.org/pypi/django-tools/
Other
128 stars 31 forks source link

Clear ThreadLocal request atttribute after response is processed #7

Closed lucaswiman closed 9 years ago

lucaswiman commented 9 years ago

@jedie This pull request updates the ThreadLocal middleware so that the thread local reference to the request object is cleared when the response is processed by the middleware.

Issue Description

This is unlikely to matter in practice since a server will overwrite the previous _thread_locals.request when it receives a new request.

The use case this is intended to fix is:

I added two views to the example app. One that returns the GET parameters from the current request, and one that simply raises an exception. I added tests that assert:

Thanks for maintaining this library!

jedie commented 9 years ago

Looks great!

Please add you to AUTHORS...

lucaswiman commented 9 years ago

Added to AUTHORS in c60c9c805510a8fb6b055cb915df9c0f1d271718. Should I update the changelog as well?

landscape-bot commented 9 years ago

Code Health Repository health decreased by 0.13% when pulling c60c9c8 on lucaswiman:master into d3f784f on jedie:master.

jedie commented 9 years ago

Should I update the changelog as well?

I will do this