diff options
| author | Tom Christie | 2012-11-09 13:49:52 +0000 |
|---|---|---|
| committer | Tom Christie | 2012-11-09 13:49:52 +0000 |
| commit | 8953a60196cb55ec75902882314da5a42636349c (patch) | |
| tree | 43bf6ea1f69955aeecd83fb9f866d92ea9a5f3df /rest_framework/response.py | |
| parent | b78872b7dbb55f1aa2d21f15fbb952f0c7156326 (diff) | |
| parent | 9aaeeacdfebc244850e82469e4af45af252cca4d (diff) | |
| download | django-rest-framework-8953a60196cb55ec75902882314da5a42636349c.tar.bz2 | |
Merge with master
Diffstat (limited to 'rest_framework/response.py')
| -rw-r--r-- | rest_framework/response.py | 14 |
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 |
