Opened 7 years ago

Last modified 2 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


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()

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

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

comment:3 Changed 6 years ago by Carlton Gibson

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

comment:4 Changed 6 years ago by Torsten Bronger

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 Changed 5 years ago by Tim Graham

I believe template widget rendering (b52c73008a9d67e9ddbb841872dc15cdd3d6ee01 introduced this issue.

comment:7 Changed 5 years ago by Martin H.

Cc: Martin H. added

comment:8 Changed 3 years ago by Matti Haavikko

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