Opened 7 years ago
Last modified 3 years ago
#28223 new Bug
Form not always picklable due to template renderer
Reported by: | Claude Paroz | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Torsten Bronger, Martin H., Matti Haavikko | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I'm confronted with a random pickling issue with some forms in Django 1.11.
The error is : PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed
I tracked the pickling error to the Form.renderer.engine.engine.template_libraries dict.
I can more or less reproduce (different error message, but hopefully same cause) with:
from django.forms.renderers import get_default_renderer import pickle renderer = get_default_renderer() renderer.engine pickle.dumps(renderer) PicklingError: Can't pickle <function add_preserved_filters at 0x7f2468bfc620>: it's not the same object as django.contrib.admin.templatetags.admin_urls.add_preserved_filters
Change History (7)
comment:1 by , 7 years ago
Summary: | Form not always picklable → Form not always picklable due to template renderer |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 6 years ago
comment:4 by , 6 years ago
Cc: | added |
---|
To copy over important information from duplicate:
This broke in 1.11 and had worked in 1.10 and before.
comment:5 by , 6 years ago
Is this bug related with this https://docs.djangoproject.com/en/2.1/releases/1.11/#django-template-backends-django-template-render-prohibits-non-dict-context ?
comment:6 by , 6 years ago
I believe template widget rendering (b52c73008a9d67e9ddbb841872dc15cdd3d6ee01 introduced this issue.
comment:7 by , 6 years ago
Cc: | added |
---|
comment:8 by , 4 years ago
Cc: | added |
---|
#29411 is a duplicate of this, with a slightly different reproduce case.