#22951: Adding 'deconstruct' method breaks serialization of type
-------------------------------------+-------------------------------------
     Reporter:  Sam Hartsfield       |                    Owner:
  <samh.public+django@…>             |  jambonrose
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7-rc-1
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by gavinwahl):

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


Comment:

 I don't think this was fixed everywhere it needed to be -- the migration
 writer is still calling deconstruct on types here:
 
https://github.com/django/django/blob/master/django/db/migrations/writer.py#L334

 {{{
 Traceback (most recent call last):
   File "./manage.py", line 11, in <module>
     execute_from_command_line(sys.argv)
   File "django/django/core/management/__init__.py", line 385, in
 execute_from_command_line
     utility.execute()
   File "django/core/management/__init__.py", line 377, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "django/core/management/base.py", line 288, in run_from_argv
     self.execute(*args, **options.__dict__)
   File "django/core/management/base.py", line 338, in execute
     output = self.handle(*args, **options)
   File "django/core/management/commands/makemigrations.py", line 124, in
 handle
     self.write_migration_files(changes)
   File "django/core/management/commands/makemigrations.py", line 152, in
 write_migration_files
     migration_string = writer.as_string()
   File "django/db/migrations/writer.py", line 131, in as_string
     operation_string, operation_imports =
 OperationWriter(operation).serialize()
   File "django/db/migrations/writer.py", line 88, in serialize
     arg_string, arg_imports = MigrationWriter.serialize(arg_value)
   File "django/db/migrations/writer.py", line 331, in serialize
     return cls.serialize_deconstructed(path, args, kwargs)
   File "django/db/migrations/writer.py", line 239, in
 serialize_deconstructed
     arg_string, arg_imports = cls.serialize(arg)
   File "django/db/migrations/writer.py", line 334, in serialize
     return cls.serialize_deconstructed(*value.deconstruct())
 TypeError: unbound method deconstruct() must be called with FooEnum
 instance as first argument (got nothing instead)
 }}}

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/103.e519726912324f4104511c49fcc17e6a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to