#24701: Migration created on python2.7 fail to load on python 3 due to
models.Manager
----------------------------+--------------------
     Reporter:  aeby        |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Migrations  |    Version:  1.8
     Severity:  Normal      |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+--------------------
 If I create a migration on python 2.7 containing a model referencing a
 ''model.Manager'' with {{{use_in_migrations = True}}} the following line
 is added in the migration file:
 {{{
 managers=[
                 (b'objects', accounts.models.UserManager()),
             ],
 }}}

 If I try to load this file under python 3.4 I get the error {{{TypeError:
 attribute name must be string, not 'bytes}}} from
 [https://github.com/django/django/blob/1.8/django/db/models/manager.py#L169
 this line].

 The problem is that the string 'objects' is prefixed with 'b' on
 [https://github.com/django/django/blob/1.8/django/db/migrations/writer.py#L340
 this line].
 I think this is maybe a bug as all other attribute names are just plain
 strings.

--
Ticket URL: <https://code.djangoproject.com/ticket/24701>
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/047.01036ffca01d49c8209a867141c9a108%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to