[Django] #25807: makemigrations failed when CharField has validators=[validate_slug]

5 views
Skip to first unread message

Django

unread,
Nov 24, 2015, 9:42:27 AM11/24/15
to django-...@googlegroups.com
#25807: makemigrations failed when CharField has validators=[validate_slug]
-------------------------------+--------------------
Reporter: mrgaolei | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.9rc1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Version 1.9rc1
When CharField have a validators=[validate_slug], it can not be
makemigrations.

it prompt:
```
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/core/management/__init__.py", line 350, in
execute_from_command_line
utility.execute()
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/core/management/__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/core/management/commands/makemigrations.py", line 150, in
handle
self.write_migration_files(changes)
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/core/management/commands/makemigrations.py", line 178, in
write_migration_files
migration_string = writer.as_string()
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/db/migrations/writer.py", line 167, in as_string
operation_string, operation_imports =
OperationWriter(operation).serialize()
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/db/migrations/writer.py", line 124, in serialize
_write(arg_name, arg_value)
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/db/migrations/writer.py", line 76, in _write
arg_string, arg_imports = MigrationWriter.serialize(item)
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/db/migrations/writer.py", line 353, in serialize
item_string, item_imports = cls.serialize(item)
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/db/migrations/writer.py", line 429, in serialize
return cls.serialize_deconstructed(path, args, kwargs)
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/db/migrations/writer.py", line 318, in
serialize_deconstructed
arg_string, arg_imports = cls.serialize(arg)
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/db/migrations/writer.py", line 353, in serialize
item_string, item_imports = cls.serialize(item)
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/db/migrations/writer.py", line 473, in serialize
return cls.serialize_deconstructed(*value.deconstruct())
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/db/migrations/writer.py", line 314, in
serialize_deconstructed
arg_string, arg_imports = cls.serialize(arg)
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/db/migrations/writer.py", line 512, in serialize
for item in value:
File "/Users/mrgaolei/Desktop/proton/venv/lib/python2.7/site-
packages/django/utils/functional.py", line 205, in inner
return func(self._wrapped, *args)
TypeError: '_sre.SRE_Pattern' object is not iterable
```

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

Django

unread,
Nov 24, 2015, 9:58:47 AM11/24/15
to django-...@googlegroups.com
#25807: makemigrations failed when CharField has validators=[validate_slug]
---------------------------------+------------------------------------
Reporter: mrgaolei | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.9rc1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* component: Uncategorized => Migrations
* needs_tests: => 0
* severity: Normal => Release blocker
* needs_docs: => 0
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted


Old description:

New description:

--

Comment:

I can reproduce the issue indeed (couldn't figure out how to make a
testcase for it though).

Bisecting the issue points to 2bb1027d6bcdad59624a9d08701e0d2e4a9c0ba7.

Thanks.

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

Django

unread,
Nov 24, 2015, 6:52:35 PM11/24/15
to django-...@googlegroups.com
#25807: makemigrations failed when CharField has validators=[validate_slug]
---------------------------------+-------------------------------------
Reporter: mrgaolei | Owner: charettes
Type: Bug | Status: assigned

Component: Migrations | Version: 1.9rc1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* owner: nobody => charettes
* status: new => assigned


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

Django

unread,
Nov 25, 2015, 12:36:22 PM11/25/15
to django-...@googlegroups.com
#25807: makemigrations failed when CharField has validators=[validate_slug]
---------------------------------+-------------------------------------
Reporter: mrgaolei | Owner: charettes
Type: Bug | Status: assigned
Component: Migrations | Version: 1.9rc1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* has_patch: 0 => 1


Comment:

https://github.com/django/django/pull/5722

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

Django

unread,
Nov 26, 2015, 11:10:06 AM11/26/15
to django-...@googlegroups.com
#25807: makemigrations failed when CharField has validators=[validate_slug]
-------------------------------------+-------------------------------------

Reporter: mrgaolei | Owner: charettes
Type: Bug | Status: assigned
Component: Migrations | Version: 1.9rc1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

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

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

* stage: Accepted => Ready for checkin


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

Django

unread,
Nov 26, 2015, 11:16:53 AM11/26/15
to django-...@googlegroups.com
#25807: makemigrations failed when CharField has validators=[validate_slug]
-------------------------------------+-------------------------------------
Reporter: mrgaolei | Owner: charettes
Type: Bug | Status: closed
Component: Migrations | Version: 1.9rc1
Severity: Release blocker | Resolution: fixed

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

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette <charette.s@…>):

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


Comment:

In [changeset:"cc2ca9c550fbf8fca8684b373a3c8e3618eea08e" cc2ca9c]:
{{{
#!CommitTicketReference repository=""
revision="cc2ca9c550fbf8fca8684b373a3c8e3618eea08e"
Fixed #25807 -- Instructed the migration writer about lazy objects.

Thanks to Trac alias mrgaolei for the report, Baptiste for the
confirmation
and Tim for the review.
}}}

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

Django

unread,
Nov 26, 2015, 11:21:58 AM11/26/15
to django-...@googlegroups.com
#25807: makemigrations failed when CharField has validators=[validate_slug]
-------------------------------------+-------------------------------------
Reporter: mrgaolei | Owner: charettes
Type: Bug | Status: closed
Component: Migrations | Version: 1.9rc1
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by Simon Charette <charette.s@…>):

In [changeset:"b4a1d545db19bb427af4043ce2c689dad856514f" b4a1d545]:
{{{
#!CommitTicketReference repository=""
revision="b4a1d545db19bb427af4043ce2c689dad856514f"
[1.9.x] Fixed #25807 -- Instructed the migration writer about lazy
objects.

Thanks to Trac alias mrgaolei for the report, Baptiste for the
confirmation
and Tim for the review.

Backport of cc2ca9c550fbf8fca8684b373a3c8e3618eea08e from master
}}}

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

Reply all
Reply to author
Forward
0 new messages