{"action":"created","issue":{"url":"https://api.github.com/repos/chibisov/drf-extensions/issues/71","labels_url":"https://api.github.com/repos/chibisov/drf-extensions/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/chibisov/drf-extensions/issues/71/comments","events_url":"https://api.github.com/repos/chibisov/drf-extensions/issues/71/events","html_url":"https://github.com/chibisov/drf-extensions/issues/71","id":55895699,"number":71,"title":"'cache_response' decorator pickle error.","user":{"login":"caxap","id":1021723,"avatar_url":"https://avatars.githubusercontent.com/u/1021723?v=3","gravatar_id":"","url":"https://api.github.com/users/caxap","html_url":"https://github.com/caxap","followers_url":"https://api.github.com/users/caxap/followers","following_url":"https://api.github.com/users/caxap/following{/other_user}","gists_url":"https://api.github.com/users/caxap/gists{/gist_id}","starred_url":"https://api.github.com/users/caxap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caxap/subscriptions","organizations_url":"https://api.github.com/users/caxap/orgs","repos_url":"https://api.github.com/users/caxap/repos","events_url":"https://api.github.com/users/caxap/events{/privacy}","received_events_url":"https://api.github.com/users/caxap/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chibisov/drf-extensions/labels/Bug","name":"Bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-29T12:58:33Z","updated_at":"2015-01-29T13:43:38Z","closed_at":null,"body":" I run into the problem after update to django-rest-framework==3.0.4 (redis==2.10.3, django-redis-cache==0.13.0):\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/home/app/local/lib/python2.7/site-packages/django/core/handlers/base.py\", line 111, in get_response\r\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\r\n  File \"/home/app/local/lib/python2.7/site-packages/django/views/decorators/csrf.py\", line 57, in wrapped_view\r\n    return view_func(*args, **kwargs)\r\n  File \"/home/app/local/lib/python2.7/site-packages/django/views/generic/base.py\", line 69, in view\r\n    return self.dispatch(request, *args, **kwargs)\r\n  File \"/home/app/local/lib/python2.7/site-packages/rest_framework/views.py\", line 407, in dispatch\r\n    response = self.handle_exception(exc)\r\n  File \"/home/app/local/lib/python2.7/site-packages/rest_framework/views.py\", line 404, in dispatch\r\n    response = handler(request, *args, **kwargs)\r\n  File \"/home/app/local/lib/python2.7/site-packages/rest_framework/generics.py\", line 278, in get\r\n    return self.retrieve(request, *args, **kwargs)\r\n  File \"/home/app/local/lib/python2.7/site-packages/rest_framework_extensions/cache/decorators.py\", line 34, in inner\r\n    kwargs=kwargs,\r\n  File \"/home/app/local/lib/python2.7/site-packages/rest_framework_extensions/cache/decorators.py\", line 56, in process_cache_response\r\n    self.cache.set(key, response, self.timeout)\r\n  File \"/home/app/local/lib/python2.7/site-packages/redis_cache/cache.py\", line 239, in set\r\n    result = self._set(key, pickle.dumps(value), timeout, client, _add_only)\r\n  File \"/home/app/lib/python2.7/copy_reg.py\", line 70, in _reduce_ex\r\n    raise TypeError, \"can't pickle %s objects\" % base.__name__\r\nTypeError: can't pickle function objects\r\n```"},"comment":{"url":"https://api.github.com/repos/chibisov/drf-extensions/issues/comments/72025312","html_url":"https://github.com/chibisov/drf-extensions/issues/71#issuecomment-72025312","issue_url":"https://api.github.com/repos/chibisov/drf-extensions/issues/71","id":72025312,"user":{"login":"chibisov","id":522462,"avatar_url":"https://avatars.githubusercontent.com/u/522462?v=3","gravatar_id":"","url":"https://api.github.com/users/chibisov","html_url":"https://github.com/chibisov","followers_url":"https://api.github.com/users/chibisov/followers","following_url":"https://api.github.com/users/chibisov/following{/other_user}","gists_url":"https://api.github.com/users/chibisov/gists{/gist_id}","starred_url":"https://api.github.com/users/chibisov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chibisov/subscriptions","organizations_url":"https://api.github.com/users/chibisov/orgs","repos_url":"https://api.github.com/users/chibisov/repos","events_url":"https://api.github.com/users/chibisov/events{/privacy}","received_events_url":"https://api.github.com/users/chibisov/received_events","type":"User","site_admin":false},"created_at":"2015-01-29T13:43:38Z","updated_at":"2015-01-29T13:43:38Z","body":"Hm, does it work without `@cache_response` decorator? Python can't pickle and store in cache your lambda function:\r\n```python\r\n>>> {'test': defaultdict(lambda: 1.0)}\r\n{'test': defaultdict(<function <lambda> at 0x100ffaaa0>, {})}\r\n```"}}