#25725: UpdateCacheMiddleware can't cache a generator response
-------------------------------------+-------------------------------------
Reporter: dracos | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Cache system) | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by codingjoe):
* cc: info@… (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
They only way I see is, closing all closeable objects, while the request
is being pickled. That's isn't too difficult, but may lead to strange
behavior, as the objects close method could have some request specific
behavior attached.
Never the less, this would be a very bad idea in the first place. If i
remember Jacob's talk correctly not even all WSGI server call close. Thus
relying on your objects to be closed in the Requests close method, well
isn't that clever.
How about
{{{#!python
def __getstate__(self):
for closable in self._closable_objects:
try:
closable.close()
except Exception:
pass
return super().__getstate__()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25725#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.b15eb1810c1f1634a6880ccfaf99e926%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.