Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@cache_response doesn't seem to be working with DRF 2.4 #32

Closed
ondrowan opened this issue Sep 6, 2014 · 5 comments
Closed

@cache_response doesn't seem to be working with DRF 2.4 #32

ondrowan opened this issue Sep 6, 2014 · 5 comments
Labels

Comments

@ondrowan
Copy link

ondrowan commented Sep 6, 2014

I'm getting following exception while using DRF 2.4 and Django 1.7:

Traceback (most recent call last):
  File "/usr/lib/python3.3/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/home/vagrant/.virtualenvs/project/lib/python3.3/site-packages/django/core/handlers/wsgi.py", line 187, in __call__
    response = self.get_response(request)
  File "/home/vagrant/.virtualenvs/project/lib/python3.3/site-packages/django/core/handlers/base.py", line 210, in get_response
    response._closable_objects.append(request)
AttributeError: 'Response' object has no attribute '_closable_objects'

It works alright if I downgrade to DRF 2.3 or remove @cache_response from given view.

@chibisov chibisov added the bug label Sep 6, 2014
@chibisov
Copy link
Owner

chibisov commented Sep 7, 2014

Hi @ondrowan.
I couldn't reproduce this bug. Could you show your view implementation?

I've added tests for drf==2.4.2, and don't see any problems with them for now:

@ondrowan
Copy link
Author

ondrowan commented Sep 7, 2014

I'm sorry, there's important fact I forgot to mention. First request always works ok, from 2nd on I get this exception.

I've made a test repo where you can try it out: https://github.com/ondrowan/drf-extensions-issue-32. It's just copy & pasted DRF tutorial with extensions added. Views are in urls.py and the only working resource is /users/. If you refresh it 2nd time, you get the exception. Restarting the server (obviously) fixes the issue for a single request.

@chibisov
Copy link
Owner

chibisov commented Sep 8, 2014

I've created issue in DRF repository. Will see, on which side this error should be handled.

@chibisov
Copy link
Owner

chibisov commented Sep 9, 2014

I've made a hack for fixing this issue. Please, give a feedback. If you don't have any problems I'll release new version.

@ondrowan
Copy link
Author

ondrowan commented Sep 9, 2014

It seems to be working fine now. Will let you know if it changes. Thanks for quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants