Fixed #18269 -- Applied unicode_literals for Python 3 compatibility. #86

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
@claudep
Member

claudep commented May 21, 2012

In Python 3, all strings without prefix are considered Unicode.
Importing unicode_literals mimics this behavior in Python 2,
rendering the code more Python 3 compatible.

Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.
In Python 3, all strings without prefix are considered Unicode.
Importing unicode_literals mimics this behavior in Python 2,
rendering the code more Python 3 compatible.

@ghost ghost assigned jezdez May 21, 2012

@alex

This comment has been minimized.

Show comment
Hide comment
@alex

alex May 21, 2012

Member

I started reviewing this patch by hand, but I realized it would take about 50 hours, so if all tests pass it looks fine to me. As soon as we have the test suite running (even if ther'es a bunch of failures) we should get a buildbot going.

Member

alex commented May 21, 2012

I started reviewing this patch by hand, but I realized it would take about 50 hours, so if all tests pass it looks fine to me. As soon as we have the test suite running (even if ther'es a bunch of failures) we should get a buildbot going.

@claudep

This comment has been minimized.

Show comment
Hide comment
@claudep

claudep May 21, 2012

Member

Alex, this will not be enough to let the test suite even start on Python 3. We'll still have to add the utils/py3.py compatibility layer, then applying at least a bunch of syntax fixes (metaclass, reraise exceptions, etc.).

Member

claudep commented May 21, 2012

Alex, this will not be enough to let the test suite even start on Python 3. We'll still have to add the utils/py3.py compatibility layer, then applying at least a bunch of syntax fixes (metaclass, reraise exceptions, etc.).

@alex

This comment has been minimized.

Show comment
Hide comment
@alex

alex May 21, 2012

Member

Right I was just thinking outloud, for the future.

Member

alex commented May 21, 2012

Right I was just thinking outloud, for the future.

@akaariai

This comment has been minimized.

Show comment
Hide comment
@akaariai

akaariai May 22, 2012

Member

Not directly related to this pull, but how are we going to guarantee that we do not introduce additional unicode literals (or other py3 incompatible changes) in the future. django-developers question maybe?

Member

akaariai commented May 22, 2012

Not directly related to this pull, but how are we going to guarantee that we do not introduce additional unicode literals (or other py3 incompatible changes) in the future. django-developers question maybe?

@alex

This comment has been minimized.

Show comment
Hide comment
@alex

alex May 22, 2012

Member

Once we can run tests on py3k that will let us know, until then we just have to be careful.

Member

alex commented May 22, 2012

Once we can run tests on py3k that will let us know, until then we just have to be careful.

@@ -2,6 +2,8 @@
# This file is distributed under the same license as the Django package.
#

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@@ -2,6 +2,8 @@
# This file is distributed under the same license as the Django package.
#

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@@ -2,6 +2,8 @@
# This file is distributed under the same license as the Django package.
#

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@@ -2,6 +2,8 @@
# This file is distributed under the same license as the Django package.
#

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@@ -2,6 +2,8 @@
# This file is distributed under the same license as the Django package.
#

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

for path in self._css[medium]]
for medium in media])
def absolute_path(self, path, prefix=None):
- if path.startswith(u'http://') or path.startswith(u'https://') or path.startswith(u'/'):

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Could probably be a tuple now.

@jezdez

jezdez Jun 7, 2012

Member

Could probably be a tuple now.

@@ -11,6 +11,8 @@
>>>
"""

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@@ -45,6 +45,26 @@ rendering or anywhere else -- you have two choices for encoding those strings.
You can use Unicode strings, or you can use normal strings (sometimes called
"bytestrings") that are encoded using UTF-8.
+In Python 3, the logic is reversed, that is normal strings are Unicode, and

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

A .. versionchanged:: 1.5 directive here would be very useful.

@jezdez

jezdez Jun 7, 2012

Member

A .. versionchanged:: 1.5 directive here would be very useful.

@@ -2,6 +2,8 @@
Tests for F() query expression syntax.
"""

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@@ -10,6 +10,8 @@
(e.g. "Staff writer").
"""

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@@ -4,6 +4,8 @@
To define a many-to-one relationship, use ``ForeignKey()``.
"""

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@@ -7,6 +7,8 @@
words, most of these tests should be rewritten.
"""

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@@ -12,6 +12,8 @@
Both styles are demonstrated here.
"""

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@@ -6,6 +6,8 @@
In this example, a ``Place`` optionally can be a ``Restaurant``.
"""

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line.

@@ -5,6 +5,8 @@
the methods.
"""

This comment has been minimized.

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line. Sigh, I think I should just say this in general 😳

@jezdez

jezdez Jun 7, 2012

Member

Unneeded empty line. Sigh, I think I should just say this in general 😳

@claudep

This comment has been minimized.

Show comment
Hide comment
@claudep

claudep Jun 7, 2012

Member

Thanks a lot for the review. Pushed in 4a10308

Member

claudep commented Jun 7, 2012

Thanks a lot for the review. Pushed in 4a10308

@claudep claudep closed this Jun 7, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment