Opened 12 years ago

Closed 12 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

Description

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:

https://code.djangoproject.com/changeset/17439

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 12 years ago.
Test and fix

Download all attachments as: .zip

Change History (8)

comment:1 by Karen Tracey, 12 years ago

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

comment:2 by Aymeric Augustin, 12 years ago

Severity: NormalRelease blocker

comment:3 by Dan Fairs, 12 years ago

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

comment:4 by Taylor Mitchell, 12 years ago

Working on this right now @ the PyCon sprints

by Taylor Mitchell, 12 years ago

Attachment: ticket17439.patch added

Test and fix

comment:5 by Taylor Mitchell, 12 years ago

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 by Karen Tracey, 12 years ago

Owner: changed from nobody to Karen Tracey

comment:7 by Karen Tracey, 12 years ago

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