Commit aa06a661 authored by Michal Čihař's avatar Michal Čihař

Use unicode literals

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 47992710
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
# All configuration values have a default; values that are commented out # All configuration values have a default; values that are commented out
# serve to show the default. # serve to show the default.
from __future__ import unicode_literals
import sys import sys
import os import os
...@@ -50,8 +51,8 @@ source_suffix = '.rst' ...@@ -50,8 +51,8 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'Weblate' project = 'Weblate'
copyright = u'2012 - 2015, Michal Čihař' copyright = '2012 - 2015, Michal Čihař'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
...@@ -210,8 +211,8 @@ latex_elements = { ...@@ -210,8 +211,8 @@ latex_elements = {
# (source start file, target name, title, # (source start file, target name, title,
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
('index', 'Weblate.tex', u'Weblate Documentation', ('index', 'Weblate.tex', 'Weblate Documentation',
u'Michal Čihař', 'manual'), 'Michal Čihař', 'manual'),
] ]
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of
...@@ -240,8 +241,8 @@ latex_documents = [ ...@@ -240,8 +241,8 @@ latex_documents = [
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [
('index', 'weblate', u'Weblate Documentation', ('index', 'weblate', 'Weblate Documentation',
[u'Michal Čihař'], 1) ['Michal Čihař'], 1)
] ]
# If true, show URL addresses after external links. # If true, show URL addresses after external links.
...@@ -254,8 +255,8 @@ man_pages = [ ...@@ -254,8 +255,8 @@ man_pages = [
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
('index', 'Weblate', u'Weblate Documentation', ('index', 'Weblate', 'Weblate Documentation',
u'Michal Čihař', 'Weblate', 'One line description of project.', 'Michal Čihař', 'Weblate', 'One line description of project.',
'Miscellaneous'), 'Miscellaneous'),
] ]
...@@ -275,13 +276,13 @@ texinfo_documents = [ ...@@ -275,13 +276,13 @@ texinfo_documents = [
# -- Options for Epub output ---------------------------------------------- # -- Options for Epub output ----------------------------------------------
# Bibliographic Dublin Core info. # Bibliographic Dublin Core info.
epub_title = u'Weblate Documentationt' epub_title = 'Weblate Documentationt'
epub_author = u'Michal Čihař' epub_author = 'Michal Čihař'
epub_publisher = u'Michal Čihař' epub_publisher = 'Michal Čihař'
epub_copyright = u'2012 - 2015, Michal Čihař' epub_copyright = '2012 - 2015, Michal Čihař'
# The basename for the epub file. It defaults to the project name. # The basename for the epub file. It defaults to the project name.
#epub_basename = u'project' #epub_basename = 'project'
# The HTML theme for the epub output. Since the default themes are not optimized # The HTML theme for the epub output. Since the default themes are not optimized
# for small screen space, using the same theme for HTML and epub output is # for small screen space, using the same theme for HTML and epub output is
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
import urllib2 import urllib2
import sys import sys
import urllib import urllib
...@@ -116,7 +118,7 @@ def get_avatar_image(user, size): ...@@ -116,7 +118,7 @@ def get_avatar_image(user, size):
Returns avatar image from cache (if available) or downloads it. Returns avatar image from cache (if available) or downloads it.
""" """
cache_key = u'avatar-img-{0}-{1}'.format( cache_key = 'avatar-img-{0}-{1}'.format(
user.username, user.username,
size size
) )
...@@ -191,13 +193,13 @@ def get_user_display(user, icon=True, link=False): ...@@ -191,13 +193,13 @@ def get_user_display(user, icon=True, link=False):
'user_avatar', kwargs={'user': user.username, 'size': 32} 'user_avatar', kwargs={'user': user.username, 'size': 32}
) )
full_name = u'<img src="{avatar}" class="avatar" /> {name}'.format( full_name = '<img src="{avatar}" class="avatar" /> {name}'.format(
name=full_name, name=full_name,
avatar=avatar avatar=avatar
) )
if link and user is not None: if link and user is not None:
return mark_safe(u'<a href="{link}">{name}</a>'.format( return mark_safe('<a href="{link}">{name}</a>'.format(
name=full_name, name=full_name,
link=reverse('user_page', kwargs={'user': user.username}), link=reverse('user_page', kwargs={'user': user.username}),
)) ))
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
Simple mathematical captcha. Simple mathematical captcha.
""" """
from __future__ import unicode_literals
from django.conf import settings from django.conf import settings
import hashlib import hashlib
...@@ -47,9 +47,9 @@ class MathCaptcha(object): ...@@ -47,9 +47,9 @@ class MathCaptcha(object):
''' '''
operators = ('+', '-', '*') operators = ('+', '-', '*')
operators_display = { operators_display = {
'+': u'+', '+': '+',
'-': u'-', '-': '-',
'*': u'×', '*': '×',
} }
interval = (1, 10) interval = (1, 10)
...@@ -118,7 +118,7 @@ class MathCaptcha(object): ...@@ -118,7 +118,7 @@ class MathCaptcha(object):
Gets unicode for display. Gets unicode for display.
''' '''
parts = self.question.split() parts = self.question.split()
return u'{0} {1} {2}'.format( return '{0} {1} {2}'.format(
parts[0], parts[0],
self.operators_display[parts[1]], self.operators_display[parts[1]],
parts[2], parts[2],
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from itertools import chain from itertools import chain
import unicodedata import unicodedata
...@@ -139,7 +140,7 @@ class SortedSelectMixin(object): ...@@ -139,7 +140,7 @@ class SortedSelectMixin(object):
selected_choices, option_value, option_label selected_choices, option_value, option_label
) )
) )
return u'\n'.join(output) return '\n'.join(output)
class SortedSelectMultiple(SortedSelectMixin, forms.SelectMultiple): class SortedSelectMultiple(SortedSelectMixin, forms.SelectMultiple):
...@@ -429,7 +430,7 @@ class PasswordForm(forms.Form): ...@@ -429,7 +430,7 @@ class PasswordForm(forms.Form):
''' '''
if len(self.cleaned_data['password1']) < 6: if len(self.cleaned_data['password1']) < 6:
raise forms.ValidationError( raise forms.ValidationError(
_(u'Password needs to have at least six characters.') _('Password needs to have at least six characters.')
) )
return self.cleaned_data['password1'] return self.cleaned_data['password1']
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User from django.contrib.auth.models import User
from optparse import make_option from optparse import make_option
...@@ -71,7 +72,7 @@ class Command(BaseCommand): ...@@ -71,7 +72,7 @@ class Command(BaseCommand):
continue continue
if line['last_name'] not in line['first_name']: if line['last_name'] not in line['first_name']:
full_name = u'{0} {1}'.format( full_name = '{0} {1}'.format(
line['first_name'], line['first_name'],
line['last_name'] line['last_name']
) )
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
import os import os
import sys import sys
import binascii import binascii
...@@ -382,7 +383,7 @@ class VerifiedEmail(models.Model): ...@@ -382,7 +383,7 @@ class VerifiedEmail(models.Model):
email = models.EmailField(max_length=254) email = models.EmailField(max_length=254)
def __unicode__(self): def __unicode__(self):
return u'{0} - {1}'.format( return '{0} - {1}'.format(
self.social.user.username, self.social.user.username,
self.email self.email
) )
...@@ -460,7 +461,7 @@ class Profile(models.Model): ...@@ -460,7 +461,7 @@ class Profile(models.Model):
''' '''
user = models.OneToOneField(User, unique=True, editable=False) user = models.OneToOneField(User, unique=True, editable=False)
language = models.CharField( language = models.CharField(
verbose_name=_(u"Interface Language"), verbose_name=_('Interface Language'),
max_length=10, max_length=10,
choices=settings.LANGUAGES choices=settings.LANGUAGES
) )
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.shortcuts import redirect from django.shortcuts import redirect
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.contrib.auth.models import User from django.contrib.auth.models import User
...@@ -160,7 +161,7 @@ def user_full_name(strategy, details, user=None, **kwargs): ...@@ -160,7 +161,7 @@ def user_full_name(strategy, details, user=None, **kwargs):
last_name = details.get('last_name', '') last_name = details.get('last_name', '')
if first_name and first_name not in last_name: if first_name and first_name not in last_name:
full_name = u'{0} {1}'.format(first_name, last_name) full_name = '{0} {1}'.format(first_name, last_name)
elif first_name: elif first_name:
full_name = first_name full_name = first_name
else: else:
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
""" """
Provides user friendly names for social authentication methods. Provides user friendly names for social authentication methods.
""" """
from __future__ import unicode_literals
from django import template from django import template
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
...@@ -44,12 +45,12 @@ SOCIALS = { ...@@ -44,12 +45,12 @@ SOCIALS = {
'stackoverflow': {'name': 'Stack Overflow', 'fa_icon': 'stackoverflow'}, 'stackoverflow': {'name': 'Stack Overflow', 'fa_icon': 'stackoverflow'},
} }
FA_SOCIAL_TEMPLATE = u''' FA_SOCIAL_TEMPLATE = '''
<i class="fa fa-lg {extra_class} fa-wl-social fa-{fa_icon}"></i> <i class="fa fa-lg {extra_class} fa-wl-social fa-{fa_icon}"></i>
{separator} {separator}
{name} {name}
''' '''
FL_SOCIAL_TEMPLATE = u''' FL_SOCIAL_TEMPLATE = '''
<span class="fl fa-lg {extra_class} fl-{fl_icon}"></span> <span class="fl fa-lg {extra_class} fl-{fl_icon}"></span>
{separator} {separator}
{name} {name}
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.shortcuts import render, get_object_or_404, redirect from django.shortcuts import render, get_object_or_404, redirect
from django.views.decorators.cache import cache_page from django.views.decorators.cache import cache_page
from django.http import HttpResponse from django.http import HttpResponse
...@@ -110,7 +111,7 @@ def mail_admins_contact(request, subject, message, context, sender): ...@@ -110,7 +111,7 @@ def mail_admins_contact(request, subject, message, context, sender):
return return
mail = EmailMultiAlternatives( mail = EmailMultiAlternatives(
u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject % context), '%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject % context),
message % context, message % context,
to=[a[1] for a in settings.ADMINS], to=[a[1] for a in settings.ADMINS],
headers={'Reply-To': sender}, headers={'Reply-To': sender},
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.contrib import admin from django.contrib import admin
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
...@@ -46,7 +47,7 @@ class BillingAdmin(admin.ModelAdmin): ...@@ -46,7 +47,7 @@ class BillingAdmin(admin.ModelAdmin):
search_fields = ('user__username', 'projects__name') search_fields = ('user__username', 'projects__name')
def list_projects(self, obj): def list_projects(self, obj):
return u','.join(obj.projects.values_list('name', flat=True)) return ','.join(obj.projects.values_list('name', flat=True))
list_projects.short_description = _('Projects') list_projects.short_description = _('Projects')
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
...@@ -56,7 +57,7 @@ class Billing(models.Model): ...@@ -56,7 +57,7 @@ class Billing(models.Model):
trial = models.BooleanField(default=False) trial = models.BooleanField(default=False)
def __unicode__(self): def __unicode__(self):
return u'{0} ({1})'.format(self.user, self.plan) return '{0} ({1})'.format(self.user, self.plan)
def count_changes(self, interval): def count_changes(self, interval):
return Change.objects.filter( return Change.objects.filter(
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.utils.translation import pgettext_lazy from django.utils.translation import pgettext_lazy
...@@ -312,44 +313,44 @@ EXTRALANGS = ( ...@@ -312,44 +313,44 @@ EXTRALANGS = (
), ),
( (
'frp', 'frp',
u'Franco-Provençal', 'Franco-Provençal',
2, 2,
'(n > 1)', '(n > 1)',
), ),
( (
'zh_Hant', 'zh_Hant',
u'Traditional Chinese', 'Traditional Chinese',
1, 1,
'0', '0',
), ),
( (
'zh_Hans', 'zh_Hans',
u'Simplified Chinese', 'Simplified Chinese',
1, 1,
'0', '0',
), ),
( (
'sh', 'sh',
u'Serbo-Croatian', 'Serbo-Croatian',
3, 3,
'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&' 'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 &&'
' (n%100<10 || n%100>=20) ? 1 : 2', ' (n%100<10 || n%100>=20) ? 1 : 2',
), ),
( (
'nl_BE', 'nl_BE',
u'Dutch (Belgium)', 'Dutch (Belgium)',
2, 2,
'(n != 1)', '(n != 1)',
), ),
( (
'ba', 'ba',
u'Bashkir', 'Bashkir',
2, 2,
'(n != 1)', '(n != 1)',
), ),
( (
'yi', 'yi',
u'Yiddish', 'Yiddish',
2, 2,
'(n != 1)', '(n != 1)',
), ),
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.db import models, transaction from django.db import models, transaction
from django.db.utils import OperationalError from django.db.utils import OperationalError
from django.utils.translation import ugettext as _, ugettext_lazy from django.utils.translation import ugettext as _, ugettext_lazy
...@@ -313,19 +314,19 @@ class LanguageManager(models.Manager): ...@@ -313,19 +314,19 @@ class LanguageManager(models.Manager):
language = Language.objects.get(code=lang) language = Language.objects.get(code=lang)
except Language.DoesNotExist: except Language.DoesNotExist:
errors.append( errors.append(
u'missing language {0}: {1} ({2})'.format( 'missing language {0}: {1} ({2})'.format(
lang, name, plurals lang, name, plurals
) )
) )
continue continue
if nplurals != language.nplurals: if nplurals != language.nplurals:
errors.append( errors.append(
u'different number of plurals {0}: {1} ({2})'.format( 'different number of plurals {0}: {1} ({2})'.format(
lang, name, plurals lang, name, plurals
) )
) )
errors.append( errors.append(
u'have {0}'.format(language.get_plural_form()) 'have {0}'.format(language.get_plural_form())
) )
return errors return errors
...@@ -387,7 +388,7 @@ class Language(models.Model, PercentMixin): ...@@ -387,7 +388,7 @@ class Language(models.Model, PercentMixin):
def __unicode__(self): def __unicode__(self):
if self.show_language_code: if self.show_language_code:
return u'{0} ({1})'.format( return '{0} ({1})'.format(
_(self.name), self.code _(self.name), self.code
) )
return _(self.name) return _(self.name)
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
import django import django
import os import os
from logging.handlers import SysLogHandler from logging.handlers import SysLogHandler
...@@ -81,40 +82,40 @@ TIME_ZONE = 'UTC' ...@@ -81,40 +82,40 @@ TIME_ZONE = 'UTC'
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
LANGUAGES = ( LANGUAGES = (
('az', u'Azərbaycan'), ('az', 'Azərbaycan'),
('be', u'Беларуская'), ('be', 'Беларуская'),
('be@latin', u'Biełaruskaja'), ('be@latin', 'Biełaruskaja'),
('br', u'Brezhoneg'), ('br', 'Brezhoneg'),
('ca', u'Català'), ('ca', 'Català'),
('cs', u'Čeština'), ('cs', 'Čeština'),
('da', u'Dansk'), ('da', 'Dansk'),
('de', u'Deutsch'), ('de', 'Deutsch'),
('en', u'English'), ('en', 'English'),
('el', u'Ελληνικά'), ('el', 'Ελληνικά'),
('es', u'Español'), ('es', 'Español'),
('fi', u'Suomi'), ('fi', 'Suomi'),
('fr', u'Français'), ('fr', 'Français'),
('fy', u'Frysk'), ('fy', 'Frysk'),
('gl', u'Galego'), ('gl', 'Galego'),
('he', u'עברית'), ('he', 'עברית'),
('hu', u'Magyar'), ('hu', 'Magyar'),
('id', 'Indonesia'), ('id', 'Indonesia'),
('ja', u'日本語'), ('ja', '日本語'),
('ko', u'한국어'), ('ko', '한국어'),
('ksh', u'Kölsch'), ('ksh', 'Kölsch'),
('nl', u'Nederlands'), ('nl', 'Nederlands'),
('pl', u'Polski'), ('pl', 'Polski'),
('pt', u'Português'), ('pt', 'Português'),
('pt-br', u'Português brasileiro'), ('pt-br', 'Português brasileiro'),
('ru', u'Русский'), ('ru', 'Русский'),
('sk', u'Slovenčina'), ('sk', 'Slovenčina'),
('sl', u'Slovenščina'), ('sl', 'Slovenščina'),
('sr', u'Српски'), ('sr', 'Српски'),
('sv', u'Svenska'), ('sv', 'Svenska'),
('tr', u'Türkçe'), ('tr', 'Türkçe'),
('uk', u'Українська'), ('uk', 'Українська'),
('zh-hans', u'简体字'), ('zh-hans', '简体字'),
('zh-hant', u'正體字'), ('zh-hant', '正體字'),
) )
SITE_ID = 1 SITE_ID = 1
...@@ -428,7 +429,7 @@ MT_GOOGLE_KEY = None ...@@ -428,7 +429,7 @@ MT_GOOGLE_KEY = None
MT_TMSERVER = None MT_TMSERVER = None
# Title of site to use # Title of site to use
SITE_TITLE = u'Weblate' SITE_TITLE = 'Weblate'
# URL of login # URL of login
LOGIN_URL = '%s/accounts/login/' % URL_PREFIX LOGIN_URL = '%s/accounts/login/' % URL_PREFIX
...@@ -446,7 +447,7 @@ ANONYMOUS_USER_NAME = 'anonymous' ...@@ -446,7 +447,7 @@ ANONYMOUS_USER_NAME = 'anonymous'
EMAIL_SEND_HTML = False EMAIL_SEND_HTML = False
# Subject of emails includes site title # Subject of emails includes site title
EMAIL_SUBJECT_PREFIX = u'[{0}] '.format(SITE_TITLE) EMAIL_SUBJECT_PREFIX = '[{0}] '.format(SITE_TITLE)
# Enable remote hooks # Enable remote hooks
ENABLE_HOOKS = True ENABLE_HOOKS = True
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from weblate.trans.models import SubProject, IndexUpdate from weblate.trans.models import SubProject, IndexUpdate
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.shortcuts import render from django.shortcuts import render
...@@ -97,7 +98,7 @@ def performance(request): ...@@ -97,7 +98,7 @@ def performance(request):
len(settings.ADMINS) > 0 or len(settings.ADMINS) > 0 or
'noreply@weblate.org' in [x[1] for x in settings.ADMINS], 'noreply@weblate.org' in [x[1] for x in settings.ADMINS],
'production-admins', 'production-admins',
u', '.join([x[1] for x in settings.ADMINS]), ', '.join([x[1] for x in settings.ADMINS]),
)) ))
# Check offloading indexing # Check offloading indexing
checks.append(( checks.append((
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from weblate.trans.autofixes.base import AutoFix from weblate.trans.autofixes.base import AutoFix
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
...@@ -30,8 +31,8 @@ class ReplaceTrailingDotsWithEllipsis(AutoFix): ...@@ -30,8 +31,8 @@ class ReplaceTrailingDotsWithEllipsis(AutoFix):
name = _('Trailing ellipsis') name = _('Trailing ellipsis')
def fix_single_target(self, target, source, unit): def fix_single_target(self, target, source, unit):
if source and source[-1] == u'…' and target.endswith('...'): if source and source[-1] == '…' and target.endswith('...'):
return u'%s…' % target[:-3], True return '%s…' % target[:-3], True
return target, False return target, False
...@@ -45,6 +46,6 @@ class RemoveZeroSpace(AutoFix): ...@@ -45,6 +46,6 @@ class RemoveZeroSpace(AutoFix):
def fix_single_target(self, target, source, unit): def fix_single_target(self, target, source, unit):
if unit.translation.language.code.split('_')[0] == 'km': if unit.translation.language.code.split('_')[0] == 'km':
return target, False return target, False
if u'\u200b' not in source and u'\u200b' in target: if '\u200b' not in source and '\u200b' in target:
return target.replace(u'\u200b', ''), True return target.replace('\u200b', ''), True
return target, False return target, False
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
import re import re
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from weblate.trans.autofixes.base import AutoFix from weblate.trans.autofixes.base import AutoFix
...@@ -47,6 +48,6 @@ class SameBookendingWhitespace(AutoFix): ...@@ -47,6 +48,6 @@ class SameBookendingWhitespace(AutoFix):
# add the whitespace around the target translation (ignore blanks) # add the whitespace around the target translation (ignore blanks)
stripped = target.strip() stripped = target.strip()
if stripped: if stripped:
newtarget = u''.join((head, stripped, tail)) newtarget = ''.join((head, stripped, tail))
return newtarget, newtarget != target return newtarget, newtarget != target
return target, False return target, False
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from weblate.trans.checks.base import ( from weblate.trans.checks.base import (
TargetCheck, TargetCheckWithFlag, CountingCheck TargetCheck, TargetCheckWithFlag, CountingCheck
...@@ -135,31 +136,31 @@ class EndStopCheck(TargetCheck): ...@@ -135,31 +136,31 @@ class EndStopCheck(TargetCheck):
if self.is_language(unit, ('th', )): if self.is_language(unit, ('th', )):
return False return False
# Allow ... to be translated into ellipsis # Allow ... to be translated into ellipsis
if source.endswith('...') and target[-1] == u'…': if source.endswith('...') and target[-1] == '…':
return False return False
if self.is_language(unit, ('ja', )) and source[-1] in (':', ';'): if self.is_language(unit, ('ja', )) and source[-1] in (':', ';'):
# Japanese sentence might need to end with full stop # Japanese sentence might need to end with full stop
# in case it's used before list. # in case it's used before list.
return self.check_chars( return self.check_chars(
source, target, -1, (u';', u':', u':', u'.', u'。') source, target, -1, (';', ':', ':', '.', '。')
) )
if self.is_language(unit, ('hy', )): if self.is_language(unit, ('hy', )):
return self.check_chars( return self.check_chars(
source, target, -1, source, target, -1,
( (
u'.', u'。', u'।', u'۔', u'։', u'·', '.', '。', '।', '۔', '։', '·',
u'෴', u'។', ':', u'՝', '?', '!', u'`', '෴', '។', ':', '՝', '?', '!', '`',
) )
) )
if self.is_language(unit, ('hi', 'bn')): if self.is_language(unit, ('hi', 'bn')):
# Using | instead of । is not typographically correct, but # Using | instead of । is not typographically correct, but
# seems to be quite usual # seems to be quite usual
return self.check_chars( return self.check_chars(
source, target, -1, (u'.', u'।', u'|') source, target, -1, ('.', '।', '|')
) )
return self.check_chars( return self.check_chars(
source, target, -1, source, target, -1,
(u'.', u'。', u'।', u'۔', u'։', u'·', u'෴', u'។') ('.', '。', '।', '۔', '։', '·', '෴', '។')
) )
...@@ -176,8 +177,8 @@ class EndColonCheck(TargetCheck): ...@@ -176,8 +177,8 @@ class EndColonCheck(TargetCheck):
colon_fr = ( colon_fr = (
' :', ' : ', ' :', ' : ',
'&nbsp;:', '&nbsp;: ', '&nbsp;:', '&nbsp;: ',
u'\u00A0:', u'\u00A0: ', '\u00A0:', '\u00A0: ',
u'\u202F:' u'\u202F: ' '\u202F:' '\u202F: '
) )
severity = 'warning' severity = 'warning'
...@@ -192,7 +193,7 @@ class EndColonCheck(TargetCheck): ...@@ -192,7 +193,7 @@ class EndColonCheck(TargetCheck):
source, source,
target, target,
-1, -1,
(u':', u'՝', u'`') (':', '՝', '`')
) )
return False return False
...@@ -204,7 +205,7 @@ class EndColonCheck(TargetCheck): ...@@ -204,7 +205,7 @@ class EndColonCheck(TargetCheck):
source, source,
target, target,
-1, -1,
(u';', u':', u':', u'.', u'。') (';', ':', ':', '.', '。')
) )
return False return False
...@@ -217,7 +218,7 @@ class EndColonCheck(TargetCheck): ...@@ -217,7 +218,7 @@ class EndColonCheck(TargetCheck):
return self._check_hy(source, target) return self._check_hy(source, target)
if self.is_language(unit, ('ja', )): if self.is_language(unit, ('ja', )):
return self._check_ja(source, target) return self._check_ja(source, target)
return self.check_chars(source, target, -1, (u':', u':', u'៖')) return self.check_chars(source, target, -1, (':', ':', '៖'))
class EndQuestionCheck(TargetCheck): class EndQuestionCheck(TargetCheck):
...@@ -233,10 +234,10 @@ class EndQuestionCheck(TargetCheck): ...@@ -233,10 +234,10 @@ class EndQuestionCheck(TargetCheck):
question_fr = ( question_fr = (
' ?', ' ? ', ' ?', ' ? ',
'&nbsp;?', '&nbsp;? ', '&nbsp;?', '&nbsp;? ',
u'\u00A0?', u'\u00A0? ', '\u00A0?', '\u00A0? ',
u'\u202F?', u'\u202F? ' '\u202F?', '\u202F? '
) )
question_el = ('?', ';', u';') question_el = ('?', ';', ';')
severity = 'warning' severity = 'warning'
def _check_fr(self, source, target): def _check_fr(self, source, target):
...@@ -250,7 +251,7 @@ class EndQuestionCheck(TargetCheck): ...@@ -250,7 +251,7 @@ class EndQuestionCheck(TargetCheck):
source, source,
target, target,
-1, -1,
(u'?', u'՞', u'։') ('?', '՞', '։')
) )
return False return False
...@@ -273,7 +274,7 @@ class EndQuestionCheck(TargetCheck): ...@@ -273,7 +274,7 @@ class EndQuestionCheck(TargetCheck):
source, source,
target, target,
-1, -1,
(u'?', u'՞', u'؟', u'⸮', u'?', u'፧', u'꘏', u'⳺') ('?', '՞', '؟', '⸮', '?', '፧', '꘏', '⳺')
) )
...@@ -290,8 +291,8 @@ class EndExclamationCheck(TargetCheck): ...@@ -290,8 +291,8 @@ class EndExclamationCheck(TargetCheck):
exclamation_fr = ( exclamation_fr = (
' !', ' ! ', ' !', ' ! ',
'&nbsp;!', '&nbsp;! ', '&nbsp;!', '&nbsp;! ',
u'\u00A0!', u'\u00A0! ', '\u00A0!', '\u00A0! ',
u'\u202F!', u'\u202F! ', '\u202F!', '\u202F! ',
) )
severity = 'warning' severity = 'warning'
...@@ -305,7 +306,7 @@ class EndExclamationCheck(TargetCheck): ...@@ -305,7 +306,7 @@ class EndExclamationCheck(TargetCheck):
return False return False
if self.is_language(unit, ('eu', )): if self.is_language(unit, ('eu', )):
if source[-1] == '!': if source[-1] == '!':
if u'¡' in target and u'!' in target: if '¡' in target and '!' in target:
return False return False
if self.is_language(unit, ('hy', )): if self.is_language(unit, ('hy', )):
return False return False
...@@ -317,7 +318,7 @@ class EndExclamationCheck(TargetCheck): ...@@ -317,7 +318,7 @@ class EndExclamationCheck(TargetCheck):
source, source,
target, target,
-1, -1,
(u'!', u'!', u'՜', u'᥄', u'႟', u'߹') ('!', '!', '՜', '᥄', '႟', '߹')
) )
...@@ -334,9 +335,9 @@ class EndEllipsisCheck(TargetCheck): ...@@ -334,9 +335,9 @@ class EndEllipsisCheck(TargetCheck):
if not target: if not target:
return False return False
# Allow ... to be translated into ellipsis # Allow ... to be translated into ellipsis
if source.endswith('...') and target[-1] == u'…': if source.endswith('...') and target[-1] == '…':
return False return False
return self.check_chars(source, target, -1, (u'…', )) return self.check_chars(source, target, -1, ('…', ))
class NewlineCountingCheck(CountingCheck): class NewlineCountingCheck(CountingCheck):
...@@ -362,7 +363,7 @@ class ZeroWidthSpaceCheck(TargetCheck): ...@@ -362,7 +363,7 @@ class ZeroWidthSpaceCheck(TargetCheck):
def check_single(self, source, target, unit): def check_single(self, source, target, unit):
if self.is_language(unit, ('km', )): if self.is_language(unit, ('km', )):
return False return False
return (u'\u200b' in target) != (u'\u200b' in source) return ('\u200b' in target) != ('\u200b' in source)
class MaxLengthCheck(TargetCheckWithFlag): class MaxLengthCheck(TargetCheckWithFlag):
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
# We ignore some words which are usually not translated # We ignore some words which are usually not translated
SAME_BLACKLIST = frozenset(( SAME_BLACKLIST = frozenset((
...@@ -834,7 +835,7 @@ SAME_BLACKLIST = frozenset(( ...@@ -834,7 +835,7 @@ SAME_BLACKLIST = frozenset((
'belgium', 'belgium',
'bengali', 'bengali',
'bodo', 'bodo',
u'bokmål', 'bokmål',
'bosnian', 'bosnian',
'brazil', 'brazil',
'breton', 'breton',
...@@ -865,7 +866,7 @@ SAME_BLACKLIST = frozenset(( ...@@ -865,7 +866,7 @@ SAME_BLACKLIST = frozenset((
'finnish', 'finnish',
'flemish', 'flemish',
'franco', 'franco',
u'franco-provençal', 'franco-provençal',
'french', 'french',
'frisian', 'frisian',
'friulian', 'friulian',
...@@ -939,7 +940,7 @@ SAME_BLACKLIST = frozenset(( ...@@ -939,7 +940,7 @@ SAME_BLACKLIST = frozenset((
'polish', 'polish',
'portugal', 'portugal',
'portuguese', 'portuguese',
u'provençal', 'provençal',
'punjabi', 'punjabi',
'pushto', 'pushto',
'romanian', 'romanian',
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from weblate.trans.checks.base import TargetCheck from weblate.trans.checks.base import TargetCheck
from weblate.trans.checks.format import ( from weblate.trans.checks.format import (
...@@ -153,7 +154,7 @@ class SameCheck(TargetCheck): ...@@ -153,7 +154,7 @@ class SameCheck(TargetCheck):
# Check special things like 1:4 1/2 or copyright # Check special things like 1:4 1/2 or copyright
if (len(source.strip('0123456789:/,.')) <= 1 or if (len(source.strip('0123456789:/,.')) <= 1 or
'(c) copyright' in lower_source or '(c) copyright' in lower_source or
u'©' in source): '©' in source):
result = True result = True
else: else:
# Strip format strings # Strip format strings
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from weblate.trans.checks.base import SourceCheck from weblate.trans.checks.base import SourceCheck
from weblate.trans.models.unitdata import Check from weblate.trans.models.unitdata import Check
...@@ -51,8 +52,8 @@ class EllipsisCheck(SourceCheck): ...@@ -51,8 +52,8 @@ class EllipsisCheck(SourceCheck):
check_id = 'ellipsis' check_id = 'ellipsis'
name = _('Ellipsis') name = _('Ellipsis')
description = _( description = _(
u'The string uses three dots (...) ' 'The string uses three dots (...) '
u'instead of an ellipsis character (…)' 'instead of an ellipsis character (…)'
) )
severity = 'warning' severity = 'warning'
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
''' '''
File format specific behavior. File format specific behavior.
''' '''
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from translate.convert import po2php from translate.convert import po2php
from translate.storage.lisa import LISAfile from translate.storage.lisa import LISAfile
...@@ -224,7 +226,7 @@ class FileUnit(object): ...@@ -224,7 +226,7 @@ class FileUnit(object):
# translate.storage.properties.propunit.gettarget # translate.storage.properties.propunit.gettarget
# which for some reason does not return translation # which for some reason does not return translation
value = quote.propertiesdecode(self.unit.value) value = quote.propertiesdecode(self.unit.value)
value = re.sub(u"\\\\ ", u" ", value) value = re.sub('\\\\ ', ' ', value)
return value return value
return self.unit.value return self.unit.value
else: else:
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django import forms from django import forms
from django.utils.translation import ( from django.utils.translation import (
ugettext_lazy as _, ugettext, pgettext_lazy, pgettext ugettext_lazy as _, ugettext, pgettext_lazy, pgettext
...@@ -44,35 +45,35 @@ from datetime import date ...@@ -44,35 +45,35 @@ from datetime import date
from weblate.logger import LOGGER from weblate.logger import LOGGER
from weblate import get_doc_url from weblate import get_doc_url
ICON_TEMPLATE = u''' ICON_TEMPLATE = '''
<i class="fa fa-{0}"></i> {1} <i class="fa fa-{0}"></i> {1}
''' '''
BUTTON_TEMPLATE = u''' BUTTON_TEMPLATE = '''
<button class="btn btn-default {0}" title="{1}" {2}>{3}</button> <button class="btn btn-default {0}" title="{1}" {2}>{3}</button>
''' '''
RADIO_TEMPLATE = u''' RADIO_TEMPLATE = '''
<label class="btn btn-default {0}" title="{1}"> <label class="btn btn-default {0}" title="{1}">
<input type="radio" name="{2}" value="{3}" {4}/> <input type="radio" name="{2}" value="{3}" {4}/>
{5} {5}
</label> </label>
''' '''
GROUP_TEMPLATE = u''' GROUP_TEMPLATE = '''
<div class="btn-group btn-group-xs" {0}>{1}</div> <div class="btn-group btn-group-xs" {0}>{1}</div>
''' '''
TOOLBAR_TEMPLATE = u''' TOOLBAR_TEMPLATE = '''
<div class="btn-toolbar pull-right flip editor-toolbar">{0}</div> <div class="btn-toolbar pull-right flip editor-toolbar">{0}</div>
''' '''
EDITOR_TEMPLATE = u''' EDITOR_TEMPLATE = '''
<div class="translation-item"> <div class="translation-item">
{0}<label for="{1}">{2}</label> {0}<label for="{1}">{2}</label>
{3} {3}
</div> </div>
''' '''
PLURALS_TEMPLATE = u''' PLURALS_TEMPLATE = '''
<p class="help-block pull-right flip"><a href="{0}">{1}</a></p> <p class="help-block pull-right flip"><a href="{0}">{1}</a></p>
<p class="help-block">{2}</p> <p class="help-block">{2}</p>
''' '''
COPY_TEMPLATE = u''' COPY_TEMPLATE = '''
data-loading-text="{0}" data-href="{1}" data-checksum="{2}" data-loading-text="{0}" data-href="{1}" data-checksum="{2}"
''' '''
...@@ -92,7 +93,7 @@ class PluralTextarea(forms.Textarea): ...@@ -92,7 +93,7 @@ class PluralTextarea(forms.Textarea):
append = '' append = ''
# Copy button # Copy button
extra_params = COPY_TEMPLATE.format( extra_params = COPY_TEMPLATE.format(
ugettext(u'Loading…'), ugettext('Loading…'),
''.join(( ''.join((
reverse('js-get', kwargs={'unit_id': unit.id}), reverse('js-get', kwargs={'unit_id': unit.id}),
append, append,
...@@ -123,7 +124,7 @@ class PluralTextarea(forms.Textarea): ...@@ -123,7 +124,7 @@ class PluralTextarea(forms.Textarea):
) )
) )
groups.append( groups.append(
GROUP_TEMPLATE.format('', u'\n'.join(chars)) GROUP_TEMPLATE.format('', '\n'.join(chars))
) )
# RTL/LTR switch # RTL/LTR switch
...@@ -150,11 +151,11 @@ class PluralTextarea(forms.Textarea): ...@@ -150,11 +151,11 @@ class PluralTextarea(forms.Textarea):
groups.append( groups.append(
GROUP_TEMPLATE.format( GROUP_TEMPLATE.format(
'data-toggle="buttons"', 'data-toggle="buttons"',
u'\n'.join(rtl_switch) '\n'.join(rtl_switch)
) )
) )
return TOOLBAR_TEMPLATE.format(u'\n'.join(groups)) return TOOLBAR_TEMPLATE.format('\n'.join(groups))
def render(self, name, unit, attrs=None): def render(self, name, unit, attrs=None):
''' '''
...@@ -202,9 +203,9 @@ class PluralTextarea(forms.Textarea): ...@@ -202,9 +203,9 @@ class PluralTextarea(forms.Textarea):
) )
# Show plural equation for more strings # Show plural equation for more strings
pluralmsg = u'' pluralmsg = ''
if len(values) > 1: if len(values) > 1:
pluralinfo = u'<abbr title="{0}">{1}</abbr>: {2}'.format( pluralinfo = '<abbr title="{0}">{1}</abbr>: {2}'.format(
ugettext( ugettext(
'This equation identifies which plural form ' 'This equation identifies which plural form '
'will be used based on given count (n).' 'will be used based on given count (n).'
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.db.models import Count from django.db.models import Count
from weblate.trans.models import Check, get_related_units from weblate.trans.models import Check, get_related_units
...@@ -50,7 +51,7 @@ class Command(BaseCommand): ...@@ -50,7 +51,7 @@ class Command(BaseCommand):
continue continue
self.stdout.write( self.stdout.write(
u'{0:5d} {1}'.format( '{0:5d} {1}'.format(
item['contentsum__count'], item['contentsum__count'],
units[0].source, units[0].source,
) )
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
import random import random
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.db import models from django.db import models
...@@ -73,7 +74,7 @@ class AdvertisementManager(models.Manager): ...@@ -73,7 +74,7 @@ class AdvertisementManager(models.Manager):
text = text.format(url) text = text.format(url)
elif placement == Advertisement.PLACEMENT_MAIL_HTML: elif placement == Advertisement.PLACEMENT_MAIL_HTML:
text, url = random.choice(self._fallback_choices_html) text, url = random.choice(self._fallback_choices_html)
text = u'<a href="{0}">{1}</a>'.format( text = '<a href="{0}">{1}</a>'.format(
url, text url, text
) )
else: else:
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.db import models, transaction from django.db import models, transaction
from django.utils.translation import ugettext as _, ugettext_lazy from django.utils.translation import ugettext as _, ugettext_lazy
from django.core.mail import mail_admins from django.core.mail import mail_admins
...@@ -906,7 +907,7 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin): ...@@ -906,7 +907,7 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
report_error(error, sys.exc_info()) report_error(error, sys.exc_info())
self.notify_merge_failure( self.notify_merge_failure(
str(error), str(error),
u''.join(traceback.format_stack()), ''.join(traceback.format_stack()),
) )
raise ParseError(str(error)) raise ParseError(str(error))
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.db import models from django.db import models
from django.db.models import Count from django.db.models import Count
from django.contrib.auth.models import User from django.contrib.auth.models import User
...@@ -118,7 +119,7 @@ class Suggestion(models.Model): ...@@ -118,7 +119,7 @@ class Suggestion(models.Model):
app_label = 'trans' app_label = 'trans'
def __unicode__(self): def __unicode__(self):
return u'suggestion for {0} by {1}'.format( return 'suggestion for {0} by {1}'.format(
self.contentsum, self.contentsum,
self.user.username if self.user else 'unknown', self.user.username if self.user else 'unknown',
) )
...@@ -183,7 +184,7 @@ class Vote(models.Model): ...@@ -183,7 +184,7 @@ class Vote(models.Model):
vote = '+1' vote = '+1'
else: else:
vote = '-1' vote = '-1'
return u'{0} for {1} by {2}'.format( return '{0} for {1} by {2}'.format(
vote, vote,
self.suggestion, self.suggestion,
self.user.username, self.user.username,
...@@ -236,7 +237,7 @@ class Comment(models.Model): ...@@ -236,7 +237,7 @@ class Comment(models.Model):
app_label = 'trans' app_label = 'trans'
def __unicode__(self): def __unicode__(self):
return u'comment for {0} by {1}'.format( return 'comment for {0} by {1}'.format(
self.contentsum, self.contentsum,
self.user.username if self.user else 'unknown', self.user.username if self.user else 'unknown',
) )
...@@ -273,7 +274,7 @@ class Check(models.Model): ...@@ -273,7 +274,7 @@ class Check(models.Model):
unique_together = ('contentsum', 'project', 'language', 'check') unique_together = ('contentsum', 'project', 'language', 'check')
def __unicode__(self): def __unicode__(self):
return u'{0}/{1}: {2}'.format( return '{0}/{1}: {2}'.format(
self.project, self.project,
self.language, self.language,
self.check, self.check,
......
This diff is collapsed.
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from django.utils.html import escape, urlize from django.utils.html import escape, urlize
from django.contrib.admin.templatetags.admin_static import static from django.contrib.admin.templatetags.admin_static import static
from django.template.loader import render_to_string from django.template.loader import render_to_string
...@@ -44,8 +45,8 @@ from weblate.trans.checks import CHECKS ...@@ -44,8 +45,8 @@ from weblate.trans.checks import CHECKS
register = template.Library() register = template.Library()
SPACE_NL = u'<span class="hlspace space-nl" title="{0}"></span><br />' SPACE_NL = '<span class="hlspace space-nl" title="{0}"></span><br />'
SPACE_TAB = u'<span class="hlspace space-tab" title="{0}"></span>' SPACE_TAB = '<span class="hlspace space-tab" title="{0}"></span>'
WHITESPACE_RE = re.compile(r'( +| $|^ )') WHITESPACE_RE = re.compile(r'( +| $|^ )')
NEWLINES_RE = re.compile(r'\r\n|\r|\n') NEWLINES_RE = re.compile(r'\r\n|\r|\n')
...@@ -61,7 +62,7 @@ NAME_MAPPING = { ...@@ -61,7 +62,7 @@ NAME_MAPPING = {
None: ugettext_lazy('Possible configuration') None: ugettext_lazy('Possible configuration')
} }
FLAG_TEMPLATE = u'<i title="{0}" class="fa fa-{1}"></i>' FLAG_TEMPLATE = '<i title="{0}" class="fa fa-{1}"></i>'
def fmt_whitespace(value): def fmt_whitespace(value):
...@@ -126,7 +127,7 @@ def format_translation(value, language, diff=None, search_match=None, ...@@ -126,7 +127,7 @@ def format_translation(value, language, diff=None, search_match=None,
for variation in re.findall(caseless, value): for variation in re.findall(caseless, value):
value = re.sub( value = re.sub(
caseless, caseless,
u'<span class="hlmatch">{0}</span>'.format(variation), '<span class="hlmatch">{0}</span>'.format(variation),
value, value,
) )
...@@ -249,10 +250,10 @@ def admin_boolean_icon(val): ...@@ -249,10 +250,10 @@ def admin_boolean_icon(val):
else: else:
ext = 'gif' ext = 'gif'
icon_url = static( icon_url = static(
u'admin/img/icon-{0}.{1}'.format(TYPE_MAPPING[val], ext) 'admin/img/icon-{0}.{1}'.format(TYPE_MAPPING[val], ext)
) )
return mark_safe( return mark_safe(
u'<img src="{url}" alt="{text}" title="{text}" />'.format( '<img src="{url}" alt="{text}" title="{text}" />'.format(
url=icon_url, url=icon_url,
text=NAME_MAPPING[val], text=NAME_MAPPING[val],
) )
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
Tests for automatix fixups. Tests for automatix fixups.
""" """
from __future__ import unicode_literals
from django.test import TestCase from django.test import TestCase
from weblate.trans.tests.test_checks import MockUnit from weblate.trans.tests.test_checks import MockUnit
from weblate.trans.autofixes import fix_target from weblate.trans.autofixes import fix_target
...@@ -33,85 +34,85 @@ from weblate.trans.autofixes.whitespace import SameBookendingWhitespace ...@@ -33,85 +34,85 @@ from weblate.trans.autofixes.whitespace import SameBookendingWhitespace
class AutoFixTest(TestCase): class AutoFixTest(TestCase):
def test_ellipsis(self): def test_ellipsis(self):
unit = MockUnit(source=u'Foo…') unit = MockUnit(source='Foo…')
fix = ReplaceTrailingDotsWithEllipsis() fix = ReplaceTrailingDotsWithEllipsis()
self.assertEqual( self.assertEqual(
fix.fix_target(['Bar...'], unit), fix.fix_target(['Bar...'], unit),
([u'Bar…'], True) (['Bar…'], True)
) )
self.assertEqual( self.assertEqual(
fix.fix_target(['Bar... '], unit), fix.fix_target(['Bar... '], unit),
([u'Bar... '], False) (['Bar... '], False)
) )
def test_no_ellipsis(self): def test_no_ellipsis(self):
unit = MockUnit(source=u'Foo...') unit = MockUnit(source='Foo...')
fix = ReplaceTrailingDotsWithEllipsis() fix = ReplaceTrailingDotsWithEllipsis()
self.assertEqual( self.assertEqual(
fix.fix_target(['Bar...'], unit), fix.fix_target(['Bar...'], unit),
([u'Bar...'], False) (['Bar...'], False)
) )
self.assertEqual( self.assertEqual(
fix.fix_target([u'Bar…'], unit), fix.fix_target(['Bar…'], unit),
([u'Bar…'], False) (['Bar…'], False)
) )
def test_whitespace(self): def test_whitespace(self):
unit = MockUnit(source=u'Foo\n') unit = MockUnit(source='Foo\n')
fix = SameBookendingWhitespace() fix = SameBookendingWhitespace()
self.assertEqual( self.assertEqual(
fix.fix_target(['Bar'], unit), fix.fix_target(['Bar'], unit),
([u'Bar\n'], True) (['Bar\n'], True)
) )
self.assertEqual( self.assertEqual(
fix.fix_target(['Bar\n'], unit), fix.fix_target(['Bar\n'], unit),
([u'Bar\n'], False) (['Bar\n'], False)
) )
unit = MockUnit(source=u' ') unit = MockUnit(source=' ')
self.assertEqual( self.assertEqual(
fix.fix_target([' '], unit), fix.fix_target([' '], unit),
([' '], False) ([' '], False)
) )
def test_no_whitespace(self): def test_no_whitespace(self):
unit = MockUnit(source=u'Foo') unit = MockUnit(source='Foo')
fix = SameBookendingWhitespace() fix = SameBookendingWhitespace()
self.assertEqual( self.assertEqual(
fix.fix_target(['Bar'], unit), fix.fix_target(['Bar'], unit),
([u'Bar'], False) (['Bar'], False)
) )
self.assertEqual( self.assertEqual(
fix.fix_target(['Bar\n'], unit), fix.fix_target(['Bar\n'], unit),
([u'Bar'], True) (['Bar'], True)
) )
def test_zerospace(self): def test_zerospace(self):
unit = MockUnit(source=u'Foo\u200b') unit = MockUnit(source='Foo\u200b')
fix = RemoveZeroSpace() fix = RemoveZeroSpace()
self.assertEqual( self.assertEqual(
fix.fix_target(['Bar'], unit), fix.fix_target(['Bar'], unit),
([u'Bar'], False) (['Bar'], False)
) )
self.assertEqual( self.assertEqual(
fix.fix_target([u'Bar\u200b'], unit), fix.fix_target(['Bar\u200b'], unit),
([u'Bar\u200b'], False) (['Bar\u200b'], False)
) )
def test_no_zerospace(self): def test_no_zerospace(self):
unit = MockUnit(source=u'Foo') unit = MockUnit(source='Foo')
fix = RemoveZeroSpace() fix = RemoveZeroSpace()
self.assertEqual( self.assertEqual(
fix.fix_target(['Bar'], unit), fix.fix_target(['Bar'], unit),
([u'Bar'], False) (['Bar'], False)
) )
self.assertEqual( self.assertEqual(
fix.fix_target([u'Bar\u200b'], unit), fix.fix_target(['Bar\u200b'], unit),
([u'Bar'], True) (['Bar'], True)
) )
def test_fix_target(self): def test_fix_target(self):
unit = MockUnit(source=u'Foo…') unit = MockUnit(source='Foo…')
fixed, fixups = fix_target(['Bar...'], unit) fixed, fixups = fix_target(['Bar...'], unit)
self.assertEqual(fixed, [u'Bar…']) self.assertEqual(fixed, ['Bar…'])
self.assertEqual(len(fixups), 1) self.assertEqual(len(fixups), 1)
self.assertEqual(unicode(fixups[0]), u'Trailing ellipsis') self.assertEqual(unicode(fixups[0]), 'Trailing ellipsis')
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
Tests for quality checks. Tests for quality checks.
""" """
from __future__ import unicode_literals
from unittest import TestCase from unittest import TestCase
from weblate.trans.checks.chars import ( from weblate.trans.checks.chars import (
BeginNewlineCheck, EndNewlineCheck, BeginNewlineCheck, EndNewlineCheck,
...@@ -80,8 +81,8 @@ class EndSpaceCheckTest(CheckTestCase): ...@@ -80,8 +81,8 @@ class EndSpaceCheckTest(CheckTestCase):
self.test_failure_2 = ('string', 'string ', '') self.test_failure_2 = ('string', 'string ', '')
def test_french(self): def test_french(self):
self.do_test(False, ('Text!', u'Texte !', ''), 'fr') self.do_test(False, ('Text!', 'Texte !', ''), 'fr')
self.do_test(True, ('Text', u'Texte ', ''), 'fr') self.do_test(True, ('Text', 'Texte ', ''), 'fr')
class EndStopCheckTest(CheckTestCase): class EndStopCheckTest(CheckTestCase):
...@@ -95,17 +96,17 @@ class EndStopCheckTest(CheckTestCase): ...@@ -95,17 +96,17 @@ class EndStopCheckTest(CheckTestCase):
self.test_failure_2 = ('string', 'string.', '') self.test_failure_2 = ('string', 'string.', '')
def test_japanese(self): def test_japanese(self):
self.do_test(False, ('Text:', u'Text。', ''), 'ja') self.do_test(False, ('Text:', 'Text。', ''), 'ja')
self.do_test(True, ('Text:', u'Text', ''), 'ja') self.do_test(True, ('Text:', 'Text', ''), 'ja')
def test_hindi(self): def test_hindi(self):
self.do_test(False, ('Text.', u'Text।', ''), 'hi') self.do_test(False, ('Text.', 'Text।', ''), 'hi')
self.do_test(True, ('Text.', u'Text', ''), 'hi') self.do_test(True, ('Text.', 'Text', ''), 'hi')
def test_armenian(self): def test_armenian(self):
self.do_test(False, ('Text:', u'Text`', ''), 'hy') self.do_test(False, ('Text:', 'Text`', ''), 'hy')
self.do_test(False, (u'Text:', u'Text՝', ''), 'hy') self.do_test(False, ('Text:', 'Text՝', ''), 'hy')
self.do_test(True, ('Text.', u'Text', ''), 'hy') self.do_test(True, ('Text.', 'Text', ''), 'hy')
class EndColonCheckTest(CheckTestCase): class EndColonCheckTest(CheckTestCase):
...@@ -118,27 +119,27 @@ class EndColonCheckTest(CheckTestCase): ...@@ -118,27 +119,27 @@ class EndColonCheckTest(CheckTestCase):
self.test_failure_2 = ('string', 'string:', '') self.test_failure_2 = ('string', 'string:', '')
def test_hy(self): def test_hy(self):
self.do_test(False, ('Text:', u'Texte՝', ''), 'hy') self.do_test(False, ('Text:', 'Texte՝', ''), 'hy')
self.do_test(True, ('Text:', u'Texte', ''), 'hy') self.do_test(True, ('Text:', 'Texte', ''), 'hy')
self.do_test(False, ('Text', u'Texte:', ''), 'hy') self.do_test(False, ('Text', 'Texte:', ''), 'hy')
def test_japanese(self): def test_japanese(self):
self.do_test(False, ('Text:', u'Texte。', ''), 'ja') self.do_test(False, ('Text:', 'Texte。', ''), 'ja')
def test_japanese_ignore(self): def test_japanese_ignore(self):
self.do_test(False, ('Text', u'Texte', ''), 'ja') self.do_test(False, ('Text', 'Texte', ''), 'ja')
def test_french_1(self): def test_french_1(self):
self.do_test(False, ('Text:', u'Texte : ', ''), 'fr') self.do_test(False, ('Text:', 'Texte : ', ''), 'fr')
def test_french_2(self): def test_french_2(self):
self.do_test(False, ('Text:', u'Texte :', ''), 'fr') self.do_test(False, ('Text:', 'Texte :', ''), 'fr')
def test_french_ignore(self): def test_french_ignore(self):
self.do_test(False, ('Text', u'Texte', ''), 'fr') self.do_test(False, ('Text', 'Texte', ''), 'fr')
def test_french_wrong(self): def test_french_wrong(self):
self.do_test(True, ('Text:', u'Texte:', ''), 'fr') self.do_test(True, ('Text:', 'Texte:', ''), 'fr')
class EndQuestionCheckTest(CheckTestCase): class EndQuestionCheckTest(CheckTestCase):
...@@ -151,29 +152,29 @@ class EndQuestionCheckTest(CheckTestCase): ...@@ -151,29 +152,29 @@ class EndQuestionCheckTest(CheckTestCase):
self.test_failure_2 = ('string', 'string?', '') self.test_failure_2 = ('string', 'string?', '')
def test_hy(self): def test_hy(self):
self.do_test(False, ('Text?', u'Texte՞', ''), 'hy') self.do_test(False, ('Text?', 'Texte՞', ''), 'hy')
self.do_test(True, ('Text?', u'Texte', ''), 'hy') self.do_test(True, ('Text?', 'Texte', ''), 'hy')
self.do_test(False, ('Text', u'Texte?', ''), 'hy') self.do_test(False, ('Text', 'Texte?', ''), 'hy')
def test_french(self): def test_french(self):
self.do_test(False, ('Text?', u'Texte ?', ''), 'fr') self.do_test(False, ('Text?', 'Texte ?', ''), 'fr')
self.do_test(False, ('Text?', u'Texte\u202F?', ''), 'fr') self.do_test(False, ('Text?', 'Texte\u202F?', ''), 'fr')
self.do_test(False, ('Text?', u'Texte&nbsp;?', ''), 'fr') self.do_test(False, ('Text?', 'Texte&nbsp;?', ''), 'fr')
def test_french_ignore(self): def test_french_ignore(self):
self.do_test(False, ('Text', u'Texte', ''), 'fr') self.do_test(False, ('Text', 'Texte', ''), 'fr')
def test_french_wrong(self): def test_french_wrong(self):
self.do_test(True, ('Text?', u'Texte?', ''), 'fr') self.do_test(True, ('Text?', 'Texte?', ''), 'fr')
def test_greek(self): def test_greek(self):
self.do_test(False, ('Text?', u'Texte;', ''), 'el') self.do_test(False, ('Text?', 'Texte;', ''), 'el')
def test_greek_ignore(self): def test_greek_ignore(self):
self.do_test(False, ('Text', u'Texte', ''), 'el') self.do_test(False, ('Text', 'Texte', ''), 'el')
def test_greek_wrong(self): def test_greek_wrong(self):
self.do_test(True, ('Text?', u'Texte', ''), 'el') self.do_test(True, ('Text?', 'Texte', ''), 'el')
class EndExclamationCheckTest(CheckTestCase): class EndExclamationCheckTest(CheckTestCase):
...@@ -186,21 +187,21 @@ class EndExclamationCheckTest(CheckTestCase): ...@@ -186,21 +187,21 @@ class EndExclamationCheckTest(CheckTestCase):
self.test_failure_2 = ('string', 'string!', '') self.test_failure_2 = ('string', 'string!', '')
def test_hy(self): def test_hy(self):
self.do_test(False, ('Text!', u'Texte՜', ''), 'hy') self.do_test(False, ('Text!', 'Texte՜', ''), 'hy')
self.do_test(False, ('Text!', u'Texte', ''), 'hy') self.do_test(False, ('Text!', 'Texte', ''), 'hy')
self.do_test(False, ('Text', u'Texte!', ''), 'hy') self.do_test(False, ('Text', 'Texte!', ''), 'hy')
def test_eu(self): def test_eu(self):
self.do_test(False, ('Text!', u'¡Texte!', ''), 'eu') self.do_test(False, ('Text!', '¡Texte!', ''), 'eu')
def test_french(self): def test_french(self):
self.do_test(False, ('Text!', u'Texte !', ''), 'fr') self.do_test(False, ('Text!', 'Texte !', ''), 'fr')
def test_french_ignore(self): def test_french_ignore(self):
self.do_test(False, ('Text', u'Texte', ''), 'fr') self.do_test(False, ('Text', 'Texte', ''), 'fr')
def test_french_wrong(self): def test_french_wrong(self):
self.do_test(True, ('Text!', u'Texte!', ''), 'fr') self.do_test(True, ('Text!', 'Texte!', ''), 'fr')
class EndEllipsisCheckTest(CheckTestCase): class EndEllipsisCheckTest(CheckTestCase):
...@@ -208,13 +209,13 @@ class EndEllipsisCheckTest(CheckTestCase): ...@@ -208,13 +209,13 @@ class EndEllipsisCheckTest(CheckTestCase):
def setUp(self): def setUp(self):
super(EndEllipsisCheckTest, self).setUp() super(EndEllipsisCheckTest, self).setUp()
self.test_good_matching = (u'string…', u'string…', '') self.test_good_matching = ('string…', 'string…', '')
self.test_failure_1 = (u'string…', 'string...', '') self.test_failure_1 = ('string…', 'string...', '')
self.test_failure_2 = ('string.', u'string…', '') self.test_failure_2 = ('string.', 'string…', '')
self.test_failure_3 = ('string..', u'string…', '') self.test_failure_3 = ('string..', 'string…', '')
def test_translate(self): def test_translate(self):
self.do_test(False, ('string...', u'string…', '')) self.do_test(False, ('string...', 'string…', ''))
class NewlineCountingCheckTest(CheckTestCase): class NewlineCountingCheckTest(CheckTestCase):
...@@ -232,9 +233,9 @@ class ZeroWidthSpaceCheckTest(CheckTestCase): ...@@ -232,9 +233,9 @@ class ZeroWidthSpaceCheckTest(CheckTestCase):
def setUp(self): def setUp(self):
super(ZeroWidthSpaceCheckTest, self).setUp() super(ZeroWidthSpaceCheckTest, self).setUp()
self.test_good_matching = (u'str\u200bing', u'str\u200bing', '') self.test_good_matching = ('str\u200bing', 'str\u200bing', '')
self.test_failure_1 = (u'str\u200bing', 'string', '') self.test_failure_1 = ('str\u200bing', 'string', '')
self.test_failure_2 = ('string', u'str\u200bing', '') self.test_failure_2 = ('string', 'str\u200bing', '')
class MaxLengthCheckTest(TestCase): class MaxLengthCheckTest(TestCase):
...@@ -246,8 +247,8 @@ class MaxLengthCheckTest(TestCase): ...@@ -246,8 +247,8 @@ class MaxLengthCheckTest(TestCase):
'max-length:12' 'max-length:12'
) )
self.test_good_matching_unicode = ( self.test_good_matching_unicode = (
u'strings', 'strings',
u'less than 21', 'less than 21',
'max-length:12' 'max-length:12'
) )
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
Tests for check views. Tests for check views.
""" """
from __future__ import unicode_literals
from weblate.trans.tests.test_views import ViewTestCase from weblate.trans.tests.test_views import ViewTestCase
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -52,7 +53,7 @@ class ChecksViewTest(ViewTestCase): ...@@ -52,7 +53,7 @@ class ChecksViewTest(ViewTestCase):
response = self.client.get( response = self.client.get(
reverse('show_check', kwargs={'name': 'ellipsis'}) reverse('show_check', kwargs={'name': 'ellipsis'})
) )
self.assertContains(response, u'…') self.assertContains(response, '…')
response = self.client.get( response = self.client.get(
reverse('show_check', kwargs={'name': 'not-existing'}) reverse('show_check', kwargs={'name': 'not-existing'})
...@@ -83,7 +84,7 @@ class ChecksViewTest(ViewTestCase): ...@@ -83,7 +84,7 @@ class ChecksViewTest(ViewTestCase):
kwargs={'name': 'ellipsis', 'project': self.project.slug} kwargs={'name': 'ellipsis', 'project': self.project.slug}
) )
) )
self.assertContains(response, u'…') self.assertContains(response, '…')
response = self.client.get( response = self.client.get(
reverse( reverse(
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
Tests for dictionary manipulations. Tests for dictionary manipulations.
""" """
from __future__ import unicode_literals
from weblate.trans.tests.test_views import ViewTestCase from weblate.trans.tests.test_views import ViewTestCase
from weblate.trans.models import Dictionary from weblate.trans.models import Dictionary
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -70,11 +71,11 @@ class DictionaryTest(ViewTestCase): ...@@ -70,11 +71,11 @@ class DictionaryTest(ViewTestCase):
# Check they are shown # Check they are shown
response = self.client.get(show_url) response = self.client.get(show_url)
self.assertContains(response, u'podpůrná vrstva') self.assertContains(response, 'podpůrná vrstva')
# Change single word # Change single word
word = Dictionary.objects.get(target=u'podpůrná vrstva') word = Dictionary.objects.get(target='podpůrná vrstva')
word.target = u'zkouška sirén' word.target = 'zkouška sirén'
word.save() word.save()
# Import file again with orverwriting # Import file again with orverwriting
...@@ -85,11 +86,11 @@ class DictionaryTest(ViewTestCase): ...@@ -85,11 +86,11 @@ class DictionaryTest(ViewTestCase):
# Check entry got overwritten # Check entry got overwritten
response = self.client.get(show_url) response = self.client.get(show_url)
self.assertContains(response, u'podpůrná vrstva') self.assertContains(response, 'podpůrná vrstva')
# Change single word # Change single word
word = Dictionary.objects.get(target=u'podpůrná vrstva') word = Dictionary.objects.get(target='podpůrná vrstva')
word.target = u'zkouška sirén' word.target = 'zkouška sirén'
word.save() word.save()
# Import file again with adding # Import file again with adding
...@@ -141,7 +142,7 @@ class DictionaryTest(ViewTestCase): ...@@ -141,7 +142,7 @@ class DictionaryTest(ViewTestCase):
# Add word # Add word
response = self.client.post( response = self.client.post(
show_url, show_url,
{'source': 'source', 'target': u'překlad'} {'source': 'source', 'target': 'překlad'}
) )
# Check correct response # Check correct response
...@@ -155,22 +156,22 @@ class DictionaryTest(ViewTestCase): ...@@ -155,22 +156,22 @@ class DictionaryTest(ViewTestCase):
# Check they are shown # Check they are shown
response = self.client.get(show_url) response = self.client.get(show_url)
self.assertContains(response, u'překlad') self.assertContains(response, 'překlad')
# Edit page # Edit page
response = self.client.get(edit_url + dict_id_url) response = self.client.get(edit_url + dict_id_url)
self.assertContains(response, u'překlad') self.assertContains(response, 'překlad')
# Edit translation # Edit translation
response = self.client.post( response = self.client.post(
edit_url + dict_id_url, edit_url + dict_id_url,
{'source': 'src', 'target': u'přkld'} {'source': 'src', 'target': 'přkld'}
) )
self.assertRedirects(response, show_url) self.assertRedirects(response, show_url)
# Check they are shown # Check they are shown
response = self.client.get(show_url) response = self.client.get(show_url)
self.assertContains(response, u'přkld') self.assertContains(response, 'přkld')
# Test deleting # Test deleting
response = self.client.post(delete_url, {'id': dict_id}) response = self.client.post(delete_url, {'id': dict_id})
...@@ -192,7 +193,7 @@ class DictionaryTest(ViewTestCase): ...@@ -192,7 +193,7 @@ class DictionaryTest(ViewTestCase):
) )
self.assertContains( self.assertContains(
response, response,
u'addon,doplněk' 'addon,doplněk'
) )
def test_download_tbx(self): def test_download_tbx(self):
...@@ -208,11 +209,11 @@ class DictionaryTest(ViewTestCase): ...@@ -208,11 +209,11 @@ class DictionaryTest(ViewTestCase):
) )
self.assertContains( self.assertContains(
response, response,
u'<term>website</term>' '<term>website</term>'
) )
self.assertContains( self.assertContains(
response, response,
u'<term>webové stránky</term>' '<term>webové stránky</term>'
) )
def test_download_po(self): def test_download_po(self):
...@@ -228,7 +229,7 @@ class DictionaryTest(ViewTestCase): ...@@ -228,7 +229,7 @@ class DictionaryTest(ViewTestCase):
) )
self.assertContains( self.assertContains(
response, response,
u'msgid "wizard"\nmsgstr "průvodce"' 'msgid "wizard"\nmsgstr "průvodce"'
) )
def test_list(self): def test_list(self):
...@@ -251,10 +252,10 @@ class DictionaryTest(ViewTestCase): ...@@ -251,10 +252,10 @@ class DictionaryTest(ViewTestCase):
response = self.client.get(dict_url) response = self.client.get(dict_url)
self.assertContains(response, 'Czech') self.assertContains(response, 'Czech')
self.assertContains(response, '1 / 7') self.assertContains(response, '1 / 7')
self.assertContains(response, u'datový tok') self.assertContains(response, 'datový tok')
# Filtering by letter # Filtering by letter
response = self.client.get(dict_url, {'letter': 'b'}) response = self.client.get(dict_url, {'letter': 'b'})
self.assertContains(response, 'Czech') self.assertContains(response, 'Czech')
self.assertContains(response, '1 / 1') self.assertContains(response, '1 / 1')
self.assertContains(response, u'datový tok') self.assertContains(response, 'datový tok')
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from unittest import TestCase from unittest import TestCase
from weblate.trans.simplediff import html_diff from weblate.trans.simplediff import html_diff
from weblate.trans.templatetags.translations import format_translation from weblate.trans.templatetags.translations import format_translation
...@@ -60,7 +61,7 @@ class DiffTest(TestCase): ...@@ -60,7 +61,7 @@ class DiffTest(TestCase):
unit.translation.subproject.project.source_language, unit.translation.subproject.project.source_language,
diff='Hello world!', diff='Hello world!',
)['items'][0]['content'], )['items'][0]['content'],
u'Hello wor<del>l</del>d!' 'Hello wor<del>l</del>d!'
) )
def test_fmtsearchmatch(self): def test_fmtsearchmatch(self):
...@@ -70,5 +71,5 @@ class DiffTest(TestCase): ...@@ -70,5 +71,5 @@ class DiffTest(TestCase):
MockLanguage('en'), MockLanguage('en'),
search_match='hello' search_match='hello'
)['items'][0]['content'], )['items'][0]['content'],
u'<span class="hlmatch">Hello</span> world!' '<span class="hlmatch">Hello</span> world!'
) )
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
Tests for translation views. Tests for translation views.
""" """
from __future__ import unicode_literals
import time import time
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -106,9 +107,9 @@ class EditTest(ViewTestCase): ...@@ -106,9 +107,9 @@ class EditTest(ViewTestCase):
response = self.edit_unit( response = self.edit_unit(
'Orangutan', 'Orangutan',
u'Opice má %d banán.\n', 'Opice má %d banán.\n',
target_1=u'Opice má %d banány.\n', target_1='Opice má %d banány.\n',
target_2=u'Opice má %d banánů.\n', target_2='Opice má %d banánů.\n',
) )
# We should get to second message # We should get to second message
self.assertRedirectsOffset(response, self.translate_url, 1) self.assertRedirectsOffset(response, self.translate_url, 1)
...@@ -118,15 +119,15 @@ class EditTest(ViewTestCase): ...@@ -118,15 +119,15 @@ class EditTest(ViewTestCase):
self.assertEqual(len(plurals), 3) self.assertEqual(len(plurals), 3)
self.assertEqual( self.assertEqual(
plurals[0], plurals[0],
u'Opice má %d banán.\n', 'Opice má %d banán.\n',
) )
self.assertEqual( self.assertEqual(
plurals[1], plurals[1],
u'Opice má %d banány.\n', 'Opice má %d banány.\n',
) )
self.assertEqual( self.assertEqual(
plurals[2], plurals[2],
u'Opice má %d banánů.\n', 'Opice má %d banánů.\n',
) )
def test_merge(self): def test_merge(self):
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
Tests for import and export. Tests for import and export.
""" """
from __future__ import unicode_literals
from weblate.trans.tests.test_views import ViewTestCase from weblate.trans.tests.test_views import ViewTestCase
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from weblate.trans.tests.utils import get_test_file from weblate.trans.tests.utils import get_test_file
...@@ -33,8 +34,8 @@ TEST_FUZZY_PO = get_test_file('cs-fuzzy.po') ...@@ -33,8 +34,8 @@ TEST_FUZZY_PO = get_test_file('cs-fuzzy.po')
TEST_MO = get_test_file('cs.mo') TEST_MO = get_test_file('cs.mo')
TEST_ANDROID = get_test_file('strings-cs.xml') TEST_ANDROID = get_test_file('strings-cs.xml')
TRANSLATION_OURS = u'Nazdar světe!\n' TRANSLATION_OURS = 'Nazdar světe!\n'
TRANSLATION_PO = u'Ahoj světe!\n' TRANSLATION_PO = 'Ahoj světe!\n'
class ImportBaseTest(ViewTestCase): class ImportBaseTest(ViewTestCase):
......
This diff is collapsed.
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
''' '''
File format specific behavior. File format specific behavior.
''' '''
from __future__ import unicode_literals
import tempfile import tempfile
from StringIO import StringIO from StringIO import StringIO
from unittest import TestCase, SkipTest from unittest import TestCase, SkipTest
...@@ -95,8 +96,8 @@ class AutoFormatTest(SimpleTestCase): ...@@ -95,8 +96,8 @@ class AutoFormatTest(SimpleTestCase):
MATCH = 'msgid_plural' MATCH = 'msgid_plural'
MASK = 'po/*.po' MASK = 'po/*.po'
EXPECTED_PATH = 'po/cs_CZ.po' EXPECTED_PATH = 'po/cs_CZ.po'
FIND = u'Hello, world!\n' FIND = 'Hello, world!\n'
FIND_MATCH = u'Ahoj světe!\n' FIND_MATCH = 'Ahoj světe!\n'
def test_parse(self): def test_parse(self):
storage = self.FORMAT(self.FILE) storage = self.FORMAT(self.FILE)
...@@ -178,7 +179,7 @@ class PoFormatTest(AutoFormatTest): ...@@ -178,7 +179,7 @@ class PoFormatTest(AutoFormatTest):
out = tempfile.NamedTemporaryFile() out = tempfile.NamedTemporaryFile()
self.FORMAT.add_language(out.name, 'cs', TEST_POT_UNICODE) self.FORMAT.add_language(out.name, 'cs', TEST_POT_UNICODE)
data = out.read().decode('utf-8') data = out.read().decode('utf-8')
self.assertTrue(u'Michal Čihař' in data) self.assertTrue('Michal Čihař' in data)
out.close() out.close()
...@@ -248,7 +249,7 @@ class XliffFormatTest(XMLMixin, AutoFormatTest): ...@@ -248,7 +249,7 @@ class XliffFormatTest(XMLMixin, AutoFormatTest):
EXT = 'xlf' EXT = 'xlf'
COUNT = 4 COUNT = 4
MATCH = '<file target-language="cs">' MATCH = '<file target-language="cs">'
FIND_MATCH = u'' FIND_MATCH = ''
MASK = 'loc/*/default.xliff' MASK = 'loc/*/default.xliff'
EXPECTED_PATH = 'loc/cs_CZ/default.xliff' EXPECTED_PATH = 'loc/cs_CZ/default.xliff'
...@@ -261,8 +262,8 @@ class RESXFormatTest(XMLMixin, AutoFormatTest): ...@@ -261,8 +262,8 @@ class RESXFormatTest(XMLMixin, AutoFormatTest):
COUNT = 4 COUNT = 4
MASK = 'resx/*.resx' MASK = 'resx/*.resx'
EXPECTED_PATH = 'resx/cs_CZ.resx' EXPECTED_PATH = 'resx/cs_CZ.resx'
FIND = u'Hello' FIND = 'Hello'
FIND_MATCH = u'' FIND_MATCH = ''
MATCH = '<root></root>' MATCH = '<root></root>'
def setUp(self): def setUp(self):
...@@ -299,7 +300,7 @@ class OutputTest(TestCase): ...@@ -299,7 +300,7 @@ class OutputTest(TestCase):
# - Newline at the end of the file # - Newline at the end of the file
# - Embedded Unicode chars (not replaced by \uxxx versions) # - Embedded Unicode chars (not replaced by \uxxx versions)
# - UTF-8 file # - UTF-8 file
json_expected_output = u'''{ json_expected_output = '''{
"string_abc": "Checkbox? ☑!", "string_abc": "Checkbox? ☑!",
"string_xyz": "Foo Bar" "string_xyz": "Foo Bar"
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
Tests for Git manipulation views. Tests for Git manipulation views.
""" """
from __future__ import unicode_literals
from weblate.trans.tests.test_views import ViewTestCase from weblate.trans.tests.test_views import ViewTestCase
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -103,7 +104,7 @@ class GitChangeProjectTest(GitNoChangeProjectTest): ...@@ -103,7 +104,7 @@ class GitChangeProjectTest(GitNoChangeProjectTest):
def setUp(self): def setUp(self):
super(GitChangeProjectTest, self).setUp() super(GitChangeProjectTest, self).setUp()
self.change_unit(u'Ahoj světe!\n') self.change_unit('Ahoj světe!\n')
class GitChangeSubProjectTest(GitChangeProjectTest): class GitChangeSubProjectTest(GitChangeProjectTest):
...@@ -129,7 +130,7 @@ class GitCommittedChangeProjectTest(GitNoChangeProjectTest): ...@@ -129,7 +130,7 @@ class GitCommittedChangeProjectTest(GitNoChangeProjectTest):
def setUp(self): def setUp(self):
super(GitCommittedChangeProjectTest, self).setUp() super(GitCommittedChangeProjectTest, self).setUp()
self.change_unit(u'Ahoj světe!\n') self.change_unit('Ahoj světe!\n')
self.project.commit_pending(self.get_request('/')) self.project.commit_pending(self.get_request('/'))
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
Tests for AJAX/JS views. Tests for AJAX/JS views.
""" """
from __future__ import unicode_literals
from weblate.trans.tests.test_views import ViewTestCase from weblate.trans.tests.test_views import ViewTestCase
from weblate.trans.util import load_class from weblate.trans.util import load_class
from weblate.trans.machine import MACHINE_TRANSLATION_SERVICES from weblate.trans.machine import MACHINE_TRANSLATION_SERVICES
...@@ -80,14 +81,14 @@ class JSViewsTest(ViewTestCase): ...@@ -80,14 +81,14 @@ class JSViewsTest(ViewTestCase):
{ {
'quality': 100, 'quality': 100,
'service': 'Dummy', 'service': 'Dummy',
'text': u'Nazdar světe!', 'text': 'Nazdar světe!',
'source': u'Hello, world!\n', 'source': 'Hello, world!\n',
}, },
{ {
'quality': 100, 'quality': 100,
'service': 'Dummy', 'service': 'Dummy',
'text': u'Ahoj světe!', 'text': 'Ahoj světe!',
'source': u'Hello, world!\n', 'source': 'Hello, world!\n',
}, },
] ]
) )
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
import httpretty import httpretty
from django.test import TestCase from django.test import TestCase
from django.core.cache import cache from django.core.cache import cache
...@@ -36,7 +37,7 @@ from weblate.trans.machine.weblatetm import ( ...@@ -36,7 +37,7 @@ from weblate.trans.machine.weblatetm import (
WeblateSimilarTranslation, WeblateTranslation WeblateSimilarTranslation, WeblateTranslation
) )
GLOSBE_JSON = u''' GLOSBE_JSON = '''
{ {
"result":"ok", "result":"ok",
"authors":{ "authors":{
...@@ -58,7 +59,7 @@ GLOSBE_JSON = u''' ...@@ -58,7 +59,7 @@ GLOSBE_JSON = u'''
"from":"eng" "from":"eng"
} }
'''.encode('utf-8') '''.encode('utf-8')
MYMEMORY_JSON = u''' MYMEMORY_JSON = '''
\r\n \r\n
{"responseData":{"translatedText":"svět"},"responseDetails":"", {"responseData":{"translatedText":"svět"},"responseDetails":"",
"responseStatus":200, "responseStatus":200,
...@@ -83,7 +84,7 @@ MYMEMORY_JSON = u''' ...@@ -83,7 +84,7 @@ MYMEMORY_JSON = u'''
"last-update-date":"2013-06-12 17:02:07","match":0.84} "last-update-date":"2013-06-12 17:02:07","match":0.84}
]} ]}
'''.encode('utf-8') '''.encode('utf-8')
AMAGAMA_JSON = u''' AMAGAMA_JSON = '''
[{"source": "World", "quality": 80.0, "target": "Svět", "rank": 100.0}] [{"source": "World", "quality": 80.0, "target": "Svět", "rank": 100.0}]
'''.encode('utf-8') '''.encode('utf-8')
GOOGLE_JSON = '[[["violation","contravention"]]]' GOOGLE_JSON = '[[["violation","contravention"]]]'
...@@ -172,7 +173,7 @@ class MachineTranslationTest(TestCase): ...@@ -172,7 +173,7 @@ class MachineTranslationTest(TestCase):
httpretty.register_uri( httpretty.register_uri(
httpretty.GET, httpretty.GET,
'http://api.microsofttranslator.com/V2/Ajax.svc/Translate', 'http://api.microsofttranslator.com/V2/Ajax.svc/Translate',
body=u'"svět"'.encode('utf-8') body='"svět"'.encode('utf-8')
) )
machine = MicrosoftTranslation() machine = MicrosoftTranslation()
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from weblate.trans.tests.test_views import ViewTestCase from weblate.trans.tests.test_views import ViewTestCase
from weblate.trans.views.reports import generate_credits, generate_counts from weblate.trans.views.reports import generate_credits, generate_counts
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -116,7 +116,7 @@ class ReportsTest(ViewTestCase): ...@@ -116,7 +116,7 @@ class ReportsTest(ViewTestCase):
'count': 1, 'count': 1,
'name': 'Weblate Test', 'name': 'Weblate Test',
'words': 2, 'words': 2,
'email': u'noreply@weblate.org' 'email': 'noreply@weblate.org'
}] }]
) )
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
Tests for quality checks. Tests for quality checks.
""" """
from __future__ import unicode_literals
from weblate.trans.checks.same import ( from weblate.trans.checks.same import (
SameCheck, SameCheck,
) )
...@@ -65,16 +66,16 @@ class SameCheckTest(CheckTestCase): ...@@ -65,16 +66,16 @@ class SameCheckTest(CheckTestCase):
self.do_test( self.do_test(
False, False,
( (
u'Linux kernel', 'Linux kernel',
u'Linux kernel', 'Linux kernel',
'' ''
) )
) )
self.do_test( self.do_test(
True, True,
( (
u'Linux kernel testing image', 'Linux kernel testing image',
u'Linux kernel testing image', 'Linux kernel testing image',
'' ''
) )
) )
...@@ -117,16 +118,16 @@ class SameCheckTest(CheckTestCase): ...@@ -117,16 +118,16 @@ class SameCheckTest(CheckTestCase):
self.do_test( self.do_test(
False, False,
( (
u'(c) Copyright 2013 Michal Čihař', '(c) Copyright 2013 Michal Čihař',
u'(c) Copyright 2013 Michal Čihař', '(c) Copyright 2013 Michal Čihař',
'' ''
) )
) )
self.do_test( self.do_test(
False, False,
( (
u'© Copyright 2013 Michal Čihař', '© Copyright 2013 Michal Čihař',
u'© Copyright 2013 Michal Čihař', '© Copyright 2013 Michal Čihař',
'' ''
) )
) )
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
Tests for source checks. Tests for source checks.
""" """
from __future__ import unicode_literals
from django.test import TestCase from django.test import TestCase
from weblate.trans.checks.source import ( from weblate.trans.checks.source import (
OptionalPluralCheck, OptionalPluralCheck,
...@@ -74,7 +75,7 @@ class EllipsisCheckTest(TestCase): ...@@ -74,7 +75,7 @@ class EllipsisCheckTest(TestCase):
def test_good(self): def test_good(self):
self.assertFalse( self.assertFalse(
self.check.check_source( self.check.check_source(
[u'text…'], ['text…'],
MockUnit(), MockUnit(),
) )
) )
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
Tests for unitdata models. Tests for unitdata models.
""" """
from __future__ import unicode_literals
from django.test import TestCase from django.test import TestCase
from weblate.lang.models import Language from weblate.lang.models import Language
from weblate.trans.models import Check, Project from weblate.trans.models import Check, Project
...@@ -45,13 +46,13 @@ class UnitdataTestCase(TestCase): ...@@ -45,13 +46,13 @@ class UnitdataTestCase(TestCase):
check = self.create_check('same') check = self.create_check('same')
self.assertEqual( self.assertEqual(
unicode(check.get_description()), unicode(check.get_description()),
u'Source and translated strings are same' 'Source and translated strings are same'
) )
self.assertEqual(check.get_severity(), 'warning') self.assertEqual(check.get_severity(), 'warning')
self.assertTrue( self.assertTrue(
check.get_doc_url().endswith('user/checks.html#check-same') check.get_doc_url().endswith('user/checks.html#check-same')
) )
self.assertEqual(unicode(check), u'test/Acholi: same') self.assertEqual(unicode(check), 'test/Acholi: same')
def test_check_nonexisting(self): def test_check_nonexisting(self):
check = self.create_check('-invalid-') check = self.create_check('-invalid-')
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from weblate.trans.tests.test_models import RepoTestCase from weblate.trans.tests.test_models import RepoTestCase
from weblate.trans.vcs import GitRepository, HgRepository, \ from weblate.trans.vcs import GitRepository, HgRepository, \
RepositoryException, GitWithGerritRepository, GithubRepository RepositoryException, GitWithGerritRepository, GithubRepository
...@@ -271,9 +272,9 @@ class VCSGitTest(RepoTestCase): ...@@ -271,9 +272,9 @@ class VCSGitTest(RepoTestCase):
self.assertTrue(self._class.get_version() != '') self.assertTrue(self._class.get_version() != '')
def test_set_committer(self): def test_set_committer(self):
self.repo.set_committer(u'Foo Bar Žač', 'foo@example.net') self.repo.set_committer('Foo Bar Žač', 'foo@example.net')
self.assertEqual( self.assertEqual(
self.repo.get_config('user.name'), u'Foo Bar Žač' self.repo.get_config('user.name'), 'Foo Bar Žač'
) )
self.assertEqual( self.assertEqual(
self.repo.get_config('user.email'), 'foo@example.net' self.repo.get_config('user.email'), 'foo@example.net'
...@@ -427,10 +428,10 @@ class VCSHgTest(VCSGitTest): ...@@ -427,10 +428,10 @@ class VCSHgTest(VCSGitTest):
self.check_valid_info(info) self.check_valid_info(info)
def test_set_committer(self): def test_set_committer(self):
self.repo.set_committer(u'Foo Bar Žač', 'foo@example.net') self.repo.set_committer('Foo Bar Žač', 'foo@example.net')
self.assertEqual( self.assertEqual(
self.repo.get_config('ui.username'), self.repo.get_config('ui.username'),
u'Foo Bar Žač <foo@example.net>' 'Foo Bar Žač <foo@example.net>'
) )
def test_status(self): def test_status(self):
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
""" """
Minimal distributed version control system abstraction for Weblate needs. Minimal distributed version control system abstraction for Weblate needs.
""" """
from __future__ import unicode_literals
import subprocess import subprocess
import os import os
import os.path import os.path
...@@ -787,7 +788,7 @@ class HgRepository(Repository): ...@@ -787,7 +788,7 @@ class HgRepository(Repository):
""" """
self.set_config( self.set_config(
'ui.username', 'ui.username',
u'{0} <{1}>'.format( '{0} <{1}>'.format(
name, name,
mail mail
) )
...@@ -933,9 +934,7 @@ class HgRepository(Repository): ...@@ -933,9 +934,7 @@ class HgRepository(Repository):
output = cls._popen(['version', '-q']) output = cls._popen(['version', '-q'])
matches = cls.VERSION_RE.match(output) matches = cls.VERSION_RE.match(output)
if matches is None: if matches is None:
raise OSError( raise OSError('Failed to parse version string: {0}'.format(output))
u'Failed to parse version string: {0}'.format(output)
)
return matches.group(1) return matches.group(1)
def commit(self, message, author=None, timestamp=None, files=None): def commit(self, message, author=None, timestamp=None, files=None):
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import unicode_literals
from weblate.trans.models.changes import Change from weblate.trans.models.changes import Change
from weblate.trans.forms import ReportsForm from weblate.trans.forms import ReportsForm
from weblate.trans.views.helper import get_subproject from weblate.trans.views.helper import get_subproject
...@@ -74,9 +75,9 @@ def get_credits(request, project, subproject): ...@@ -74,9 +75,9 @@ def get_credits(request, project, subproject):
if form.cleaned_data['style'] == 'html': if form.cleaned_data['style'] == 'html':
start = '<table>' start = '<table>'
row_start = '<tr>' row_start = '<tr>'
language_format = u'<th>{0}</th>' language_format = '<th>{0}</th>'
translator_start = '<td><ul>' translator_start = '<td><ul>'
translator_format = u'<li><a href="mailto:{0}">{1}</a></li>' translator_format = '<li><a href="mailto:{0}">{1}</a></li>'
translator_end = '</ul></td>' translator_end = '</ul></td>'
row_end = '</tr>' row_end = '</tr>'
mime = 'text/html' mime = 'text/html'
...@@ -84,9 +85,9 @@ def get_credits(request, project, subproject): ...@@ -84,9 +85,9 @@ def get_credits(request, project, subproject):
else: else:
start = '' start = ''
row_start = '' row_start = ''
language_format = u'* {0}\n' language_format = '* {0}\n'
translator_start = '' translator_start = ''
translator_format = u' * {1} <{0}>' translator_format = ' * {1} <{0}>'
translator_end = '' translator_end = ''
row_end = '' row_end = ''
mime = 'text/plain' mime = 'text/plain'
...@@ -101,7 +102,7 @@ def get_credits(request, project, subproject): ...@@ -101,7 +102,7 @@ def get_credits(request, project, subproject):
result.append(row_start) result.append(row_start)
result.append(language_format.format(name)) result.append(language_format.format(name))
result.append( result.append(
u'{0}{1}{2}'.format( '{0}{1}{2}'.format(
translator_start, translator_start,
'\n'.join( '\n'.join(
[translator_format.format(*t) for t in translators] [translator_format.format(*t) for t in translators]
...@@ -177,7 +178,7 @@ def get_counts(request, project, subproject): ...@@ -177,7 +178,7 @@ def get_counts(request, project, subproject):
'<th>Words</th><th>Count</th></tr>' '<th>Words</th><th>Count</th></tr>'
) )
row_start = '<tr>' row_start = '<tr>'
cell_name = cell_email = cell_words = cell_count = u'<td>{0}</td>\n' cell_name = cell_email = cell_words = cell_count = '<td>{0}</td>\n'
row_end = '</tr>' row_end = '</tr>'
mime = 'text/html' mime = 'text/html'
end = '</table>' end = '</table>'
...@@ -196,8 +197,8 @@ def get_counts(request, project, subproject): ...@@ -196,8 +197,8 @@ def get_counts(request, project, subproject):
'Count' 'Count'
) )
row_start = '' row_start = ''
cell_name = cell_email = u'{0:40} ' cell_name = cell_email = '{0:40} '
cell_words = cell_count = u'{0:10} ' cell_words = cell_count = '{0:10} '
row_end = '' row_end = ''
mime = 'text/plain' mime = 'text/plain'
end = heading end = heading
...@@ -210,7 +211,7 @@ def get_counts(request, project, subproject): ...@@ -210,7 +211,7 @@ def get_counts(request, project, subproject):
if row_start: if row_start:
result.append(row_start) result.append(row_start)
result.append( result.append(
u'{0}{1}{2}{3}'.format( '{0}{1}{2}{3}'.format(
cell_name.format(item['name']), cell_name.format(item['name']),
cell_email.format(item['email']), cell_email.format(item['email']),
cell_words.format(item['words']), cell_words.format(item['words']),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment