[Django] #21852: Migration serializer cannot handle iterables

2 views
Skip to first unread message

Django

unread,
Jan 22, 2014, 2:52:35 AM1/22/14
to django-...@googlegroups.com
#21852: Migration serializer cannot handle iterables
----------------------------+---------------------
Reporter: MarkusH | Owner: MarkusH
Type: Bug | Status: new
Component: Migrations | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+---------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/21852>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 22, 2014, 3:10:51 AM1/22/14
to django-...@googlegroups.com
#21852: Migration serializer cannot handle iterables
----------------------------+--------------------------------------
Reporter: MarkusH | Owner: MarkusH
Type: Bug | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------
Changes (by MarkusH):

* status: new => assigned
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Pull request is at https://github.com/django/django/pull/2198

--
Ticket URL: <https://code.djangoproject.com/ticket/21852#comment:1>

Django

unread,
Jan 22, 2014, 3:21:49 AM1/22/14
to django-...@googlegroups.com
#21852: Migration serializer cannot handle iterators
----------------------------+--------------------------------------
Reporter: MarkusH | Owner: MarkusH
Type: Bug | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/21852#comment:2>

Django

unread,
Jan 22, 2014, 3:39:09 AM1/22/14
to django-...@googlegroups.com
#21852: Migration serializer cannot handle iterators
----------------------------+---------------------------------------------
Reporter: MarkusH | Owner: MarkusH
Type: Bug | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for checkin

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------+---------------------------------------------
Changes (by bmispelon):

* stage: Unreviewed => Ready for checkin


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/21852#comment:3>

Django

unread,
Jan 22, 2014, 4:11:16 AM1/22/14
to django-...@googlegroups.com
#21852: Migration serializer cannot handle iterators
----------------------------+---------------------------------------------
Reporter: MarkusH | Owner: MarkusH
Type: Bug | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for checkin
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------+---------------------------------------------

Comment (by MarkusH):

Thanks bmispelon,

Looking at the
[http://docs.python.org/3/library/collections.abc.html?highlight=collections%20iterable
#collections-abstract-base-classes 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`.

--
Ticket URL: <https://code.djangoproject.com/ticket/21852#comment:4>

Django

unread,
Jan 22, 2014, 6:45:46 AM1/22/14
to django-...@googlegroups.com
#21852: Migration serializer cannot handle iterators
----------------------------+---------------------------------------------
Reporter: MarkusH | Owner: MarkusH
Type: Bug | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for checkin
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------+---------------------------------------------
Changes (by Markus Holtermann <info@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"047394f79c2cbc6cf44684a1f0d17aba1ddfe1c8"]:
{{{
#!CommitTicketReference repository=""
revision="047394f79c2cbc6cf44684a1f0d17aba1ddfe1c8"
Fixed #21852 -- Make migration writer serialize iterators
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21852#comment:5>

Django

unread,
Jan 22, 2014, 6:45:46 AM1/22/14
to django-...@googlegroups.com
#21852: Migration serializer cannot handle iterators
----------------------------+---------------------------------------------
Reporter: MarkusH | Owner: MarkusH
Type: Bug | Status: closed
Component: Migrations | Version: master

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for checkin
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------+---------------------------------------------

Comment (by Andrew Godwin <andrew@…>):

In [changeset:"a5ec11c4bbb8f82e02871f154b3cfe0008b00a2b"]:
{{{
#!CommitTicketReference repository=""
revision="a5ec11c4bbb8f82e02871f154b3cfe0008b00a2b"
Merge pull request #2198 from Markush2010/ticket21852

Fixed #21852 -- Make migration writer serialize iterators
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21852#comment:6>

Reply all
Reply to author
Forward
0 new messages