Implement student-initiated refunds for external commerce service.
XCOM-306
This commit is contained in:
@@ -2,6 +2,7 @@ import threading
|
||||
|
||||
_request_cache_threadlocal = threading.local()
|
||||
_request_cache_threadlocal.data = {}
|
||||
_request_cache_threadlocal.request = None
|
||||
|
||||
|
||||
class RequestCache(object):
|
||||
@@ -9,11 +10,21 @@ class RequestCache(object):
|
||||
def get_request_cache(cls):
|
||||
return _request_cache_threadlocal
|
||||
|
||||
@classmethod
|
||||
def get_current_request(cls):
|
||||
"""
|
||||
Get a reference to the HttpRequest object, if we are presently
|
||||
servicing one.
|
||||
"""
|
||||
return _request_cache_threadlocal.request
|
||||
|
||||
def clear_request_cache(self):
|
||||
_request_cache_threadlocal.data = {}
|
||||
_request_cache_threadlocal.request = None
|
||||
|
||||
def process_request(self, request):
|
||||
self.clear_request_cache()
|
||||
_request_cache_threadlocal.request = request
|
||||
return None
|
||||
|
||||
def process_response(self, request, response):
|
||||
|
||||
Reference in New Issue
Block a user