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 Tim Graham, 7 years ago

Summary: Form not always picklableForm not always picklable due to template renderer
Triage Stage: UnreviewedAccepted

comment:3 by Carlton Gibson, 6 years ago

#29411 is a duplicate of this, with a slightly different reproduce case.

comment:4 by Torsten Bronger, 6 years ago

Cc: Torsten Bronger added

To copy over important information from duplicate:

This broke in 1.11 and had worked in 1.10 and before.

comment:6 by Tim Graham, 6 years ago

I believe template widget rendering (b52c73008a9d67e9ddbb841872dc15cdd3d6ee01 introduced this issue.

comment:7 by Martin H., 5 years ago

Cc: Martin H. added

comment:8 by Matti Haavikko, 4 years ago

Cc: Matti Haavikko added
Note: See TracTickets for help on using tickets.
Back to Top