Opened 7 years ago

Closed 7 years ago

#17879 closed Bug (fixed)

Regression in serializers when using natural keys

Reported by: Dan Fairs Owned by: Karen Tracey
Component: Core (Serialization) Version:
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The Python serializer's handle_fk_field() method now no longer handles the case where a related object is None and natural keys are in use. The problem appears to have been introduced in this changeset:

The code now no longer checks to see if the related object is not None before attempting to call natural_key() on it.

Attachments (1)

ticket17439.patch (3.5 KB) - added by Taylor Mitchell 7 years ago.
Test and fix

Download all attachments as: .zip

Change History (8)

comment:1 Changed 7 years ago by Karen Tracey

Upon inspection this appears to be a regression therefore marking as release blocker. I don't supposed you have a test?

comment:2 Changed 7 years ago by Aymeric Augustin

Severity: NormalRelease blocker

comment:3 Changed 7 years ago by Dan Fairs

Not yet - I'll try to put one together as soon as I can (realistically, over the next day or so.)

comment:4 Changed 7 years ago by Taylor Mitchell

Working on this right now @ the PyCon sprints

Changed 7 years ago by Taylor Mitchell

Attachment: ticket17439.patch added

Test and fix

comment:5 Changed 7 years ago by Taylor Mitchell

Has patch: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

D'oh referenced the wrong ticket in the patch, but the patch is for this ticket.

comment:6 Changed 7 years ago by Karen Tracey

Owner: changed from nobody to Karen Tracey

comment:7 Changed 7 years ago by Karen Tracey

Resolution: fixed
Status: newclosed

In [17685]:

Fix #17879: Corrected regression in python (inherited by yaml and json) serializer that prevented serializing model instances with null FK ref to a model when serializing with natural keys. Thanks danfairs and tmitchell.

Note: See TracTickets for help on using tickets.
Back to Top