mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Remove attributes that are not needed when caching
the Response object. This fixes #346
This commit is contained in:
parent
44f280c3ab
commit
963c5fe4a7
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user