Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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

Closed
wants to merge 1 commit into from

4 participants

Claude Paroz Alex Gaynor Anssi Kääriäinen Jannis Leidel
Claude Paroz
Owner
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.

Claude Paroz 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.
f0bc3d1
Alex Gaynor
Owner
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.

Claude Paroz
Owner
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 Gaynor
Owner
alex commented May 21, 2012

Right I was just thinking outloud, for the future.

Anssi Kääriäinen
Owner

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 Gaynor
Owner
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.

Jannis Leidel jezdez commented on the diff June 07, 2012
django/conf/locale/bg/formats.py
@@ -2,6 +2,8 @@
2 2
 # This file is distributed under the same license as the Django package.
3 3
 #
4 4
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
django/conf/locale/fi/formats.py
@@ -2,6 +2,8 @@
2 2
 # This file is distributed under the same license as the Django package.
3 3
 #
4 4
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
django/conf/locale/hu/formats.py
@@ -2,6 +2,8 @@
2 2
 # This file is distributed under the same license as the Django package.
3 3
 #
4 4
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
django/conf/locale/lv/formats.py
@@ -2,6 +2,8 @@
2 2
 # This file is distributed under the same license as the Django package.
3 3
 #
4 4
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
django/conf/locale/pl/formats.py
@@ -2,6 +2,8 @@
2 2
 # This file is distributed under the same license as the Django package.
3 3
 #
4 4
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
django/contrib/webdesign/tests.py
... ...
@@ -1,5 +1,7 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
django/forms/widgets.py
((6 lines not shown))
65 65
                     for path in self._css[medium]]
66 66
                 for medium in media])
67 67
 
68 68
     def absolute_path(self, path, prefix=None):
69  
-        if path.startswith(u'http://') or path.startswith(u'https://') or path.startswith(u'/'):
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Could probably be a tuple now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
django/utils/dateformat.py
@@ -11,6 +11,8 @@
11 11
 >>>
12 12
 """
13 13
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
docs/ref/unicode.txt
@@ -45,6 +45,26 @@ rendering or anywhere else -- you have two choices for encoding those strings.
45 45
 You can use Unicode strings, or you can use normal strings (sometimes called
46 46
 "bytestrings") that are encoded using UTF-8.
47 47
 
  48
+In Python 3, the logic is reversed, that is normal strings are Unicode, and
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
tests/modeltests/expressions/models.py
@@ -2,6 +2,8 @@
2 2
 Tests for F() query expression syntax.
3 3
 """
4 4
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
tests/modeltests/m2m_intermediary/models.py
@@ -10,6 +10,8 @@
10 10
 (e.g. "Staff writer").
11 11
 """
12 12
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
tests/modeltests/many_to_one/models.py
@@ -4,6 +4,8 @@
4 4
 To define a many-to-one relationship, use ``ForeignKey()``.
5 5
 """
6 6
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
tests/modeltests/model_forms/models.py
@@ -7,6 +7,8 @@
7 7
 words, most of these tests should be rewritten.
8 8
 """
9 9
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
tests/modeltests/model_inheritance/models.py
@@ -12,6 +12,8 @@
12 12
 Both styles are demonstrated here.
13 13
 """
14 14
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
tests/modeltests/one_to_one/models.py
@@ -6,6 +6,8 @@
6 6
 In this example, a ``Place`` optionally can be a ``Restaurant``.
7 7
 """
8 8
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

Unneeded empty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jannis Leidel jezdez commented on the diff June 07, 2012
tests/modeltests/save_delete_hooks/models.py
@@ -5,6 +5,8 @@
5 5
 the methods.
6 6
 """
7 7
 
1
Jannis Leidel Owner
jezdez added a note June 07, 2012

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

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

Thanks a lot for the review. Pushed in 4a10308

Claude Paroz claudep closed this June 07, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

May 21, 2012
Claude Paroz 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.
f0bc3d1
Something went wrong with that request. Please try again.