Skip to content

Commit

Permalink
Add process_response handler to unset the middleware request object.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Wiman committed Mar 17, 2016
1 parent 5806e9b commit 4ecf837
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions simple_history/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ class HistoryRequestMiddleware(object):

def process_request(self, request):
HistoricalRecords.thread.request = request

def process_response(self, request, response):
if hasattr(HistoricalRecords.thread, 'request'):
del HistoricalRecords.thread.request
return response

0 comments on commit 4ecf837

Please sign in to comment.