aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/response.py
diff options
context:
space:
mode:
Diffstat (limited to 'rest_framework/response.py')
-rw-r--r--rest_framework/response.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/rest_framework/response.py b/rest_framework/response.py
index 7a459c8f..0de01204 100644
--- a/rest_framework/response.py
+++ b/rest_framework/response.py
@@ -9,7 +9,8 @@ class Response(SimpleTemplateResponse):
"""
def __init__(self, data=None, status=200,
- template_name=None, headers=None):
+ template_name=None, headers=None,
+ exception=False):
"""
Alters the init arguments slightly.
For example, drop 'template_name', and instead use 'data'.
@@ -21,6 +22,7 @@ class Response(SimpleTemplateResponse):
self.data = data
self.headers = headers and headers[:] or []
self.template_name = template_name
+ self.exception = exception
@property
def rendered_content(self):
@@ -45,3 +47,13 @@ class Response(SimpleTemplateResponse):
# TODO: Deprecate and use a template tag instead
# TODO: Status code text for RFC 6585 status codes
return STATUS_CODE_TEXT.get(self.status_code, '')
+
+ def __getstate__(self):
+ """
+ Remove attributes from the response that shouldn't be cached
+ """
+ state = super(Response, self).__getstate__()
+ for key in ('accepted_renderer', 'renderer_context', 'data'):
+ if key in state:
+ del state[key]
+ return state