#15012 closed (fixed)
cache_page decorator (memcached) fails with Django 1.3b1 (can't pickle Input object)
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Generic views | Version: | 1.3-beta |
Severity: | Keywords: | pickle, memcached, blocker | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hello,
I'm consistently getting an error with each request after upgrading from Django 1.3a1 to 1.3b1.
The settings aren't changed after the upgrade, and if I remove the cache_page decorator, everything is back on track. The url in question is pasted below:
url(r'^/?$', cache_page(views.IndexView.as_view(), timeout), name='main_index')
Attachments (4)
Change History (11)
by , 14 years ago
Attachment: | cache_page.error added |
---|
comment:1 by , 14 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
We're going to need a bit more than a stack trace. We have an test suite checking cache_page, and those tests are passing. There is clearly something special about your page.
We need a reproducible test case to be able to accept this bug. Please reopen if you can provide a simple view that fails in the way you describe.
by , 14 years ago
Attachment: | cache_page_test.tar.bz2 added |
---|
a simple project which causes the error
comment:2 by , 14 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
I've attached a generic django project, with an app that only contains 1 view that is cached. The only setting that was changed was the cache setting. The apache directory contains the wsgi and virtualhost configs for apache.
Running this through apache reproduces this error. Interestingly, running it through the internal server produces a different error, which is still connected to the cache_page:
a class that defines __slots__ without defining __getstate__ cannot be pickled
comment:3 by , 14 years ago
Component: | Cache system → Generic views |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
Ah. This is a bit of a problem. The introduction of TemplateResponse means that the cache page decorator can't be used on Template Views. Which is a fairly major omission.
We either need to make generic views use normal responses (and make TemplateResponse an available option), or we need to find a way to let decorators (especially the cache decorator) play nice with TemplateResponse.
This is definitely a 1.3 blocker.
comment:4 by , 14 years ago
Keywords: | blocker added |
---|
by , 14 years ago
Attachment: | 15012.diff added |
---|
Patch to fix the issue (includes previously attached tests)
comment:5 by , 14 years ago
Has patch: | set |
---|
Attached a patch - it puts pre_render and post_render callbacks into the TemplateResponse and modifies the cache middleware, in the face of a TemplateResponse, to register a callback on the TemplateResponse to store the final rendered copy in cache. I included russelm's test cases in the patch.
-jag
comment:6 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
traceback, META and settings