diff options
| author | Jacob Magnusson | 2012-11-04 12:48:41 +0100 |
|---|---|---|
| committer | Jacob Magnusson | 2012-11-04 12:48:41 +0100 |
| commit | 963c5fe4a702f906576ae66e2c4c3193896fcd38 (patch) | |
| tree | 28653480666197bf0d454a412d4ece2991c5f2e5 /rest_framework | |
| parent | 44f280c3abf3832a4a43be4fc52dc807f4cb6a70 (diff) | |
| download | django-rest-framework-963c5fe4a702f906576ae66e2c4c3193896fcd38.tar.bz2 | |
Remove attributes that are not needed when caching
the Response object. This fixes #346
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/response.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/rest_framework/response.py b/rest_framework/response.py index 7a459c8f..006d7eeb 100644 --- a/rest_framework/response.py +++ b/rest_framework/response.py @@ -45,3 +45,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 |
