Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#21852 closed Bug (fixed)

Migration serializer cannot handle iterators

Reported by: Markus Holtermann Owned by: Markus Holtermann
Component: Migrations Version: dev
Severity: Normal Keywords:
Cc: info@… Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If the choices attribute of a model field is an iterable (not list, tuple, etc, but a e.g. a generator) the migration writer fails lacking a serialization path.

I suggest to serialize the iterable as a tuple.

Change History (6)

comment:1 by Markus Holtermann, 11 years ago

Status: newassigned

comment:2 by Markus Holtermann, 11 years ago

Summary: Migration serializer cannot handle iterablesMigration serializer cannot handle iterators

comment:3 by Baptiste Mispelon, 11 years ago

Triage Stage: UnreviewedReady for checkin

I can reproduce the issue.

The proposed patch looks good: the added test fails with current master and passes after applying the patch.

I wonder however if collections.Iterator should be used instead of collections.Iterable, but that's just nitpicking.

I'll mark this as ready for checkin and try to get a second set of eyes to check it out before committing.

Thanks.

comment:4 by Markus Holtermann, 11 years ago

Thanks bmispelon,

Looking at the collections documentation the table shows, that e.g. a Sequence is an Iterable but not an Iterator. That's why I'd stay with Iterable.

comment:5 by Markus Holtermann <info@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In 047394f79c2cbc6cf44684a1f0d17aba1ddfe1c8:

Fixed #21852 -- Make migration writer serialize iterators

comment:6 by Andrew Godwin <andrew@…>, 11 years ago

In a5ec11c4bbb8f82e02871f154b3cfe0008b00a2b:

Merge pull request #2198 from Markush2010/ticket21852

Fixed #21852 -- Make migration writer serialize iterators

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