Permalink
Browse files

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

Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
  • Loading branch information...
1 parent 706fd9a commit 4a103086d5c67fa4fcc53c106c9fdf644c742dd8 @claudep claudep committed Jun 7, 2012
Showing 401 changed files with 6,647 additions and 6,157 deletions.
Oops, something went wrong.
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -19,5 +20,5 @@
# TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' ' # Non-breaking space
+THOUSAND_SEPARATOR = ' ' # Non-breaking space
# NUMBER_GROUPING =
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -33,5 +34,5 @@
'%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
@@ -37,7 +37,7 @@
'%m/%d/%y %H:%M', # '10/25/06 14:30'
'%m/%d/%y', # '10/25/06'
)
-DECIMAL_SEPARATOR = u'.'
-THOUSAND_SEPARATOR = u','
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
NUMBER_GROUPING = 3
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
DATE_FORMAT = r'j \d\e F \d\e Y'
TIME_FORMAT = 'H:i:s'
@@ -24,5 +25,5 @@
'%d/%m/%y %H:%M',
)
DECIMAL_SEPARATOR = '.' # ',' is also official (less common): NOM-008-SCFI-2002
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -19,5 +20,5 @@
# TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' ' # Non-breaking space
+THOUSAND_SEPARATOR = ' ' # Non-breaking space
# NUMBER_GROUPING =
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -19,5 +20,5 @@
# TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' ' # Non-breaking space
+THOUSAND_SEPARATOR = ' ' # Non-breaking space
# NUMBER_GROUPING =
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -37,5 +38,5 @@
'%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -28,5 +29,5 @@
'%Y.%m.%d.', # '2006.10.25.'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' ' # Non-breaking space
+THOUSAND_SEPARATOR = ' ' # Non-breaking space
NUMBER_GROUPING = 3
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -37,5 +38,5 @@
'%d.%m.%y', # '25.10.06'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' ' # Non-breaking space
+THOUSAND_SEPARATOR = ' ' # Non-breaking space
NUMBER_GROUPING = 3
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -39,5 +40,5 @@
'%d.%m.%y', # '25.10.06'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -39,5 +40,5 @@
'%d.%m.%y', # '25.10.06'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -33,5 +34,5 @@
'%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' '
+THOUSAND_SEPARATOR = ' '
NUMBER_GROUPING = 3
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -36,5 +37,5 @@
'%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -33,5 +34,5 @@
'%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -36,5 +37,5 @@
'%m/%d/%y', # '10/25/06'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
@@ -2,6 +2,8 @@
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
+
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j E Y р.'
@@ -19,5 +21,5 @@
# TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' '
+THOUSAND_SEPARATOR = ' '
# NUMBER_GROUPING =
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -1,9 +1,10 @@
+from __future__ import unicode_literals
+
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User
-
from django.utils.translation import ugettext_lazy, ugettext as _
ERROR_MESSAGE = ugettext_lazy("Please enter the correct username and password "
@@ -25,7 +26,7 @@ def clean(self):
if username and password:
self.user_cache = authenticate(username=username, password=password)
if self.user_cache is None:
- if u'@' in username:
+ if '@' in username:
# Mistakenly entered e-mail address instead of username? Look it up.
try:
user = User.objects.get(email=username)
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from django import forms
from django.contrib.admin.util import (flatten_fieldsets, lookup_field,
display_for_field, label_for_field, help_text_for_field)
@@ -69,7 +71,7 @@ def __init__(self, form, name=None, readonly_fields=(), fields=(), classes=(),
description=None, model_admin=None):
self.form = form
self.name, self.fields = name, fields
- self.classes = u' '.join(classes)
+ self.classes = ' '.join(classes)
self.description = description
self.model_admin = model_admin
self.readonly_fields = readonly_fields
@@ -109,7 +111,7 @@ def __iter__(self):
yield AdminField(self.form, field, is_first=(i == 0))
def errors(self):
- return mark_safe(u'\n'.join([self.form[f].errors.as_ul() for f in self.fields if f not in self.readonly_fields]).strip('\n'))
+ return mark_safe('\n'.join([self.form[f].errors.as_ul() for f in self.fields if f not in self.readonly_fields]).strip('\n'))
class AdminField(object):
def __init__(self, form, field, is_first):
@@ -121,14 +123,14 @@ def label_tag(self):
classes = []
contents = conditional_escape(force_unicode(self.field.label))
if self.is_checkbox:
- classes.append(u'vCheckboxLabel')
+ classes.append('vCheckboxLabel')
else:
- contents += u':'
+ contents += ':'
if self.field.field.required:
- classes.append(u'required')
+ classes.append('required')
if not self.is_first:
- classes.append(u'inline')
- attrs = classes and {'class': u' '.join(classes)} or {}
+ classes.append('inline')
+ attrs = classes and {'class': ' '.join(classes)} or {}
return self.field.label_tag(contents=mark_safe(contents), attrs=attrs)
def errors(self):
@@ -161,7 +163,7 @@ def label_tag(self):
if not self.is_first:
attrs["class"] = "inline"
label = self.field['label']
- contents = capfirst(force_unicode(escape(label))) + u":"
+ contents = capfirst(force_unicode(escape(label))) + ":"
return mark_safe('<label%(attrs)s>%(contents)s</label>' % {
"attrs": flatatt(attrs),
"contents": contents,
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
@@ -64,5 +66,5 @@ def get_admin_url(self):
This is relative to the Django admin index page.
"""
if self.content_type and self.object_id:
- return mark_safe(u"%s/%s/%s/" % (self.content_type.app_label, self.content_type.model, quote(self.object_id)))
+ return mark_safe("%s/%s/%s/" % (self.content_type.app_label, self.content_type.model, quote(self.object_id)))
return None
Oops, something went wrong.

0 comments on commit 4a10308

Please sign in to comment.