Re: [Django] #22564: Migrations generated by Python 2 do not work in Python 3 due to b'' prefix on strings

2014-05-06 Thread Django
#22564: Migrations generated by Python 2 do not work in Python 3 due to b'' 
prefix
on strings
-+-
 Reporter:  timo |Owner:  claudep
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:
 Severity:  Release blocker  |  1.7-beta-2
 Keywords:   |   Resolution:  fixed
Has patch:  1| Triage Stage:  Ready for
  Needs tests:  0|  checkin
Easy pickings:  0|  Needs documentation:  0
 |  Patch needs improvement:  0
 |UI/UX:  0
-+-

Comment (by claudep):

 Master commits: 12474dacef3b85b1115f78aec905cc3079c68fb1 and
 da9cf53cb536511a8abaade9f20e1dd8c4a02c7d

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.f96e4ef975fa1ba3807340c366633322%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22564: Migrations generated by Python 2 do not work in Python 3 due to b'' prefix on strings

2014-05-06 Thread Django
#22564: Migrations generated by Python 2 do not work in Python 3 due to b'' 
prefix
on strings
-+-
 Reporter:  timo |Owner:  claudep
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:
 Severity:  Release blocker  |  1.7-beta-2
 Keywords:   |   Resolution:  fixed
Has patch:  1| Triage Stage:  Ready for
  Needs tests:  0|  checkin
Easy pickings:  0|  Needs documentation:  0
 |  Patch needs improvement:  0
 |UI/UX:  0
-+-
Changes (by Claude Paroz ):

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


Comment:

 In [changeset:"0d138b9cf450b213b950595527b63d253926609d"]:
 {{{
 #!CommitTicketReference repository=""
 revision="0d138b9cf450b213b950595527b63d253926609d"
 [1.7.x] Fixed #22564 -- Prevented unneeded bytestrings in migrations

 In some cases, this could lead to migrations written with Python 2
 being incompatible with Python 3.
 Thanks Tim Graham for the report and Loïc Bistuer for the advices.
 Backport of da9cf53cb from master.
 }}}

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.ac0eabdc8e906c9acab8a0ab5791b74b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22564: Migrations generated by Python 2 do not work in Python 3 due to b'' prefix on strings

2014-05-06 Thread Django
#22564: Migrations generated by Python 2 do not work in Python 3 due to b'' 
prefix
on strings
-+-
 Reporter:  timo |Owner:  claudep
 Type:  Bug  |   Status:  assigned
Component:  Migrations   |  Version:
 Severity:  Release blocker  |  1.7-beta-2
 Keywords:   |   Resolution:
Has patch:  1| Triage Stage:  Ready for
  Needs tests:  0|  checkin
Easy pickings:  0|  Needs documentation:  0
 |  Patch needs improvement:  0
 |UI/UX:  0
-+-

Comment (by Claude Paroz ):

 In [changeset:"e8f1395f4e65f9d2ffc7a0448980ebaca0b2991a"]:
 {{{
 #!CommitTicketReference repository=""
 revision="e8f1395f4e65f9d2ffc7a0448980ebaca0b2991a"
 [1.7.x] Added a bunch of missing unicode_literals

 Refs #22564.
 Backport of 12474dace from master.
 }}}

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.5f88ce613c998d3e2141b3742821494c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22564: Migrations generated by Python 2 do not work in Python 3 due to b'' prefix on strings

2014-05-05 Thread Django
#22564: Migrations generated by Python 2 do not work in Python 3 due to b'' 
prefix
on strings
-+-
 Reporter:  timo |Owner:  claudep
 Type:  Bug  |   Status:  assigned
Component:  Migrations   |  Version:
 Severity:  Release blocker  |  1.7-beta-2
 Keywords:   |   Resolution:
Has patch:  1| Triage Stage:  Ready for
  Needs tests:  0|  checkin
Easy pickings:  0|  Needs documentation:  0
 |  Patch needs improvement:  0
 |UI/UX:  0
-+-
Changes (by loic84):

 * stage:  Accepted => Ready for checkin


Comment:

 LGTM.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.27140d4f00e4cf3d0dfb5ea21b75b7d5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22564: Migrations generated by Python 2 do not work in Python 3 due to b'' prefix on strings

2014-05-05 Thread Django
#22564: Migrations generated by Python 2 do not work in Python 3 due to b'' 
prefix
on strings
-+--
 Reporter:  timo |Owner:  claudep
 Type:  Bug  |   Status:  assigned
Component:  Migrations   |  Version:  1.7-beta-2
 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 claudep):

 * has_patch:  0 => 1


Comment:

 PR: https://github.com/django/django/pull/2635

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.4ae3c39edb8325f9c4b50aa06df54497%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22564: Migrations generated by Python 2 do not work in Python 3 due to b'' prefix on strings

2014-05-05 Thread Django
#22564: Migrations generated by Python 2 do not work in Python 3 due to b'' 
prefix
on strings
-+--
 Reporter:  timo |Owner:  claudep
 Type:  Bug  |   Status:  assigned
Component:  Migrations   |  Version:  1.7-beta-2
 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 claudep):

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


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.b1ee57b3951dafba9e5f3e527a2a09d7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22564: Migrations generated by Python 2 do not work in Python 3 due to b'' prefix on strings

2014-05-02 Thread Django
#22564: Migrations generated by Python 2 do not work in Python 3 due to b'' 
prefix
on strings
-+--
 Reporter:  timo |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  1.7-beta-2
 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
-+--

Comment (by claudep):

 Fair, let's try to solve it above the serialization level.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.81bbe61c4b57deb305eafd7bf11f9f0f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22564: Migrations generated by Python 2 do not work in Python 3 due to b'' prefix on strings

2014-05-02 Thread Django
#22564: Migrations generated by Python 2 do not work in Python 3 due to b'' 
prefix
on strings
-+--
 Reporter:  timo |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  1.7-beta-2
 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
-+--

Comment (by loic84):

 The serializer doesn't know much about the context, it receives objects
 one by one recursively, and when it finds a `byte`, it could come from
 anywhere, so it should IMO render it as a `byte`.

 I don't think we should cast `byte` into unicode strings at serialization
 time, maybe the reconstructed object actually expected a `byte`, the
 proper fix is to feed the serializer with the expected type, either by
 normalizing the output of `ForeignKey.deconstruct()` to unicode, or by
 fixing it even deeper (probably in Model._meta).

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.a8037bee7fb61c0a61e4321018883e5e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22564: Migrations generated by Python 2 do not work in Python 3 due to b'' prefix on strings

2014-05-02 Thread Django
#22564: Migrations generated by Python 2 do not work in Python 3 due to b'' 
prefix
on strings
-+--
 Reporter:  timo |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  1.7-beta-2
 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
-+--

Comment (by claudep):

 Replying to [comment:2 loic84]:
 > ...what's received by the serializer as a `byte` needs to remain a
 `byte`, hence the prefix.

 Could you elaborate a bit about that assertion? What problem could arise
 if we always output "normal" strings.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.29099b6cc910dee94aa9604198c4adea%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22564: Migrations generated by Python 2 do not work in Python 3 due to b'' prefix on strings

2014-05-02 Thread Django
#22564: Migrations generated by Python 2 do not work in Python 3 due to b'' 
prefix
on strings
-+--
 Reporter:  timo |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  1.7-beta-2
 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 loic84):

 * cc: loic@… (added)


Comment:

 It's not easy, we do include `unicode_literals` in migrations so that PY2
 and PY3 agree to speak the same dialect, but what's received by the
 serializer as a `byte` needs to remain a `byte`, hence the prefix.

 We need to either relax the assertion, or ensure
 `ForeignKey.deconstruct()` returns a unicode string, preferably the
 latter. If I remember well, a bunch of meta are stored as `byte`, so I'm
 guessing that's how it lands in the output of `ForeignKey.deconstruct()`.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.6abcaef5e4bc9a351b246df968791635%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #22564: Migrations generated by Python 2 do not work in Python 3 due to b'' prefix on strings

2014-05-02 Thread Django
#22564: Migrations generated by Python 2 do not work in Python 3 due to b'' 
prefix
on strings
-+--
 Reporter:  timo |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  1.7-beta-2
 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
-+--

Comment (by claudep):

 +1, I also encountered this. We don't need prefixes, we now import
 unicode_literals in migration files.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.e6a6684c099f9dc42c89072e8a167c3f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #22564: Migrations generated by Python 2 do not work in Python 3 due to b'' prefix on strings

2014-05-02 Thread Django
#22564: Migrations generated by Python 2 do not work in Python 3 due to b'' 
prefix
on strings
---+
   Reporter:  timo |  Owner:  nobody
   Type:  Bug  | Status:  new
  Component:  Migrations   |Version:  1.7-beta-2
   Severity:  Release blocker  |   Keywords:
   Triage Stage:  Accepted |  Has patch:  0
Needs documentation:  0|Needs tests:  0
Patch needs improvement:  0|  Easy pickings:  0
  UI/UX:  0|
---+
 I think this is an issue if we expect apps to be able to support both
 Python 2 and 3.

 {{{
   File "/home/tim/code/mysite/polls/migrations/0001_initial.py", line 7,
 in 
 class Migration(migrations.Migration):
   File "/home/tim/code/mysite/polls/migrations/0001_initial.py", line 28,
 in Migration
 (b'poll', models.ForeignKey(to=b'polls.Poll', to_field='id')),
   File "/home/tim/code/django/django/db/models/fields/related.py", line
 1589, in __init__
 assert isinstance(to, six.string_types), "%s(%r) is invalid. First
 parameter to ForeignKey must be either a model, a model name, or the
 string %r" % (self.__class__.__name__, to,
 RECURSIVE_RELATIONSHIP_CONSTANT)
 AssertionError: ForeignKey(b'polls.Poll') is invalid. First parameter to
 ForeignKey must be either a model, a model name, or the string 'self'
 }}}

 `six.string_types` is `str` on Python 3, not `bytes`.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/047.79e2a04c9d7af790f0f800cbacf8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.