Commit ee5a81f9 authored by Weblate's avatar Weblate

Merge remote-tracking branch 'origin/master'

parents c4dea040 66ef8d47
......@@ -28,11 +28,11 @@ before_script:
# commands to run tests
script:
- ./scripts/generate-locales
- ./manage.py validate --settings weblate.settings_test_$TRAVIS_DATABASE
- ./manage.py syncdb --noinput --settings weblate.settings_test_$TRAVIS_DATABASE
- ./manage.py migrate --settings weblate.settings_test_$TRAVIS_DATABASE --traceback
- coverage run --source=. ./manage.py test --settings weblate.settings_test_$TRAVIS_DATABASE trans lang accounts
- pep8 --exclude migrations accounts trans lang weblate
- pylint --reports=n --rcfile=pylint.rc trans accounts weblate lang
- ./manage.py validate --settings weblate.settings_test
- ./manage.py syncdb --noinput --settings weblate.settings_test
- ./manage.py migrate --settings weblate.settings_test --traceback
- coverage run --source=. ./manage.py test --settings weblate.settings_test weblate.trans weblate.lang weblate.accounts
- pep8 --exclude migrations weblate
- pylint --reports=n --rcfile=pylint.rc weblate
after_success:
- coveralls
......@@ -56,7 +56,7 @@ For example, enabling authentication against GitHub:
AUTHENTICATION_BACKENDS = (
'social.backends.github.GithubOAuth2',
'social.backends.email.EmailAuth',
'accounts.auth.WeblateUserBackend',
'weblate.accounts.auth.WeblateUserBackend',
)
# Social auth backends setup
......
......@@ -66,8 +66,8 @@ For example you can enable only few of them:
.. code-block:: python
AUTOFIX_LIST = (
'trans.autofixes.whitespace.SameBookendingWhitespace',
'trans.autofixes.chars.ReplaceTrailingDotsWithEllipsis',
'weblate.trans.autofixes.whitespace.SameBookendingWhitespace',
'weblate.trans.autofixes.chars.ReplaceTrailingDotsWithEllipsis',
)
.. seealso:: :ref:`autofix`, :ref:`custom-autofix`
......@@ -95,9 +95,9 @@ For example you can enable only few of them:
.. code-block:: python
CHECK_LIST = (
'trans.checks.same.SameCheck',
'trans.checks.format.CFormatCheck',
'trans.checks.chars.ZeroWidthSpaceCheck',
'weblate.trans.checks.same.SameCheck',
'weblate.trans.checks.format.CFormatCheck',
'weblate.trans.checks.chars.ZeroWidthSpaceCheck',
)
.. seealso:: :ref:`checks`, :ref:`custom-checks`
......@@ -190,15 +190,15 @@ List of enabled machine translation services to use.
.. code-block:: python
MACHINE_TRANSLATION_SERVICES = (
'trans.machine.apertium.ApertiumTranslation',
'trans.machine.glosbe.GlosbeTranslation',
'trans.machine.google.GoogleTranslation',
'trans.machine.microsoft.MicrosoftTranslation',
'trans.machine.mymemory.MyMemoryTranslation',
'trans.machine.opentran.OpenTranTranslation',
'trans.machine.tmserver.TMServerTranslation',
'trans.machine.weblatetm.WeblateSimilarTranslation',
'trans.machine.weblatetm.WeblateTranslation',
'weblate.trans.machine.apertium.ApertiumTranslation',
'weblate.trans.machine.glosbe.GlosbeTranslation',
'weblate.trans.machine.google.GoogleTranslation',
'weblate.trans.machine.microsoft.MicrosoftTranslation',
'weblate.trans.machine.mymemory.MyMemoryTranslation',
'weblate.trans.machine.opentran.OpenTranTranslation',
'weblate.trans.machine.tmserver.TMServerTranslation',
'weblate.trans.machine.weblatetm.WeblateSimilarTranslation',
'weblate.trans.machine.weblatetm.WeblateTranslation',
)
.. seealso:: :ref:`machine-translation-setup`, :ref:`machine-translation`
......
......@@ -151,6 +151,13 @@ name, please adjust your :file:`settings.py` to match that (consult
Also please note that there are several new requirements, see
:ref:`requirements` for more details.
Upgrade from 1.8 to 1.9
~~~~~~~~~~~~~~~~~~~~~~~
Several internal modules and paths have been renamed and changed, please adjust
your :file:`settings.py` to match that (consult :file:`settings_example.py` for
correct values).
.. _pootle-migration:
Migrating from Pootle
......
......@@ -19,7 +19,7 @@
#
from django.contrib import admin
from accounts.models import Profile, VerifiedEmail
from weblate.accounts.models import Profile, VerifiedEmail
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
......
......@@ -22,10 +22,10 @@ from django import forms
from django.utils.translation import ugettext_lazy as _, get_language
from django.contrib.auth.forms import AuthenticationForm
from accounts.models import Profile, VerifiedEmail
from accounts.captcha import MathCaptcha
from lang.models import Language
from trans.models import Project
from weblate.accounts.models import Profile, VerifiedEmail
from weblate.accounts.captcha import MathCaptcha
from weblate.lang.models import Language
from weblate.trans.models import Project
from django.contrib.auth.models import User
from django.utils.encoding import force_unicode
from itertools import chain
......
......@@ -20,7 +20,7 @@
from django.core.management.base import BaseCommand
from optparse import make_option
from accounts.models import create_groups, move_users
from weblate.accounts.models import create_groups, move_users
class Command(BaseCommand):
......
......@@ -34,9 +34,9 @@ from django.core.mail import EmailMultiAlternatives
from south.signals import post_migrate
from social.apps.django_app.default.models import UserSocialAuth
from lang.models import Language
from trans.models import Project, Change
from trans.util import (
from weblate.lang.models import Language
from weblate.trans.models import Project, Change
from weblate.trans.util import (
get_user_display, get_site_url, get_distinct_translations
)
import weblate
......@@ -542,7 +542,7 @@ class Profile(models.Model):
'''
Returns list of secondary units.
'''
from trans.models.unit import Unit
from weblate.trans.models.unit import Unit
secondary_langs = self.secondary_languages.exclude(
id=unit.translation.language.id
)
......@@ -690,7 +690,7 @@ def sync_create_groups(sender, app, **kwargs):
Create groups on syncdb.
'''
if (app == 'accounts'
or getattr(app, '__name__', '') == 'accounts.models'):
or getattr(app, '__name__', '') == 'weblate.accounts.models'):
create_groups(False)
......
......@@ -24,7 +24,7 @@ from django.core.urlresolvers import reverse
from social.pipeline.partial import partial
from social.exceptions import AuthForbidden
from accounts.models import send_notification_email, VerifiedEmail
from weblate.accounts.models import send_notification_email, VerifiedEmail
from weblate import appsettings
......
......@@ -31,7 +31,7 @@ from django.conf import settings
from django.core.management import call_command
from django.http import HttpRequest, HttpResponseRedirect
from accounts.models import (
from weblate.accounts.models import (
Profile,
notify_merge_failure,
notify_new_string,
......@@ -41,13 +41,15 @@ from accounts.models import (
notify_new_contributor,
notify_new_language,
)
from accounts.captcha import hash_question, unhash_question, MathCaptcha
from accounts.middleware import RequireLoginMiddleware
from weblate.accounts.captcha import (
hash_question, unhash_question, MathCaptcha
)
from weblate.accounts.middleware import RequireLoginMiddleware
from trans.tests.test_views import ViewTestCase
from trans.tests.test_util import get_test_file
from trans.models.unitdata import Suggestion, Comment
from lang.models import Language
from weblate.trans.tests.test_views import ViewTestCase
from weblate.trans.tests.test_util import get_test_file
from weblate.trans.models.unitdata import Suggestion, Comment
from weblate.lang.models import Language
from weblate import appsettings
REGISTRATION_DATA = {
......
......@@ -20,7 +20,7 @@
from django.conf.urls import patterns, url, include
from accounts.views import RegistrationTemplateView
from weblate.accounts.views import RegistrationTemplateView
urlpatterns = patterns(
......@@ -32,12 +32,15 @@ urlpatterns = patterns(
),
name='email-sent'
),
url(r'^password/', 'accounts.views.password', name='password'),
url(r'^reset/', 'accounts.views.reset_password', name='password_reset'),
url(r'^logout/', 'accounts.views.weblate_logout', name='logout'),
url(r'^profile/', 'accounts.views.user_profile', name='profile'),
url(r'^login/$', 'accounts.views.weblate_login', name='login'),
url(r'^register/$', 'accounts.views.register', name='register'),
url(r'^email/$', 'accounts.views.email_login', name='email_login'),
url(r'^password/', 'weblate.accounts.views.password', name='password'),
url(
r'^reset/', 'weblate.accounts.views.reset_password',
name='password_reset'
),
url(r'^logout/', 'weblate.accounts.views.weblate_logout', name='logout'),
url(r'^profile/', 'weblate.accounts.views.user_profile', name='profile'),
url(r'^login/$', 'weblate.accounts.views.weblate_login', name='login'),
url(r'^register/$', 'weblate.accounts.views.register', name='register'),
url(r'^email/$', 'weblate.accounts.views.email_login', name='email_login'),
url(r'', include('social.apps.django_app.urls', namespace='social')),
)
......@@ -31,7 +31,7 @@ from django.contrib.auth.views import login, logout
from django.views.generic import TemplateView
from urllib import urlencode
from accounts.forms import (
from weblate.accounts.forms import (
RegistrationForm, PasswordForm, PasswordChangeForm, EmailForm, ResetForm,
LoginForm, HostingForm, CaptchaRegistrationForm
)
......@@ -39,9 +39,9 @@ from social.backends.utils import load_backends
from social.apps.django_app.utils import BACKENDS
from social.apps.django_app.views import complete
from accounts.models import set_lang, Profile
from trans.models import Change, Project
from accounts.forms import (
from weblate.accounts.models import set_lang, Profile
from weblate.trans.models import Change, Project
from weblate.accounts.forms import (
ProfileForm, SubscriptionForm, UserForm, ContactForm
)
from weblate import appsettings
......
......@@ -19,7 +19,7 @@
#
from django.conf import settings
from trans.util import get_script_name
from weblate.trans.util import get_script_name
import os
......@@ -97,42 +97,42 @@ WHOOSH_INDEX = get('WHOOSH_INDEX', os.path.join(WEB_ROOT, 'whoosh-index'))
# List of quality checks
CHECK_LIST = get('CHECK_LIST', (
'trans.checks.same.SameCheck',
'trans.checks.chars.BeginNewlineCheck',
'trans.checks.chars.EndNewlineCheck',
'trans.checks.chars.BeginSpaceCheck',
'trans.checks.chars.EndSpaceCheck',
'trans.checks.chars.EndStopCheck',
'trans.checks.chars.EndColonCheck',
'trans.checks.chars.EndQuestionCheck',
'trans.checks.chars.EndExclamationCheck',
'trans.checks.chars.EndEllipsisCheck',
'trans.checks.format.PythonFormatCheck',
'trans.checks.format.PythonBraceFormatCheck',
'trans.checks.format.PHPFormatCheck',
'trans.checks.format.CFormatCheck',
'trans.checks.consistency.PluralsCheck',
'trans.checks.consistency.ConsistencyCheck',
'trans.checks.chars.NewlineCountingCheck',
'trans.checks.markup.BBCodeCheck',
'trans.checks.chars.ZeroWidthSpaceCheck',
'trans.checks.markup.XMLTagsCheck',
'trans.checks.source.OptionalPluralCheck',
'trans.checks.source.EllipsisCheck',
'trans.checks.source.MultipleFailingCheck',
'weblate.trans.checks.same.SameCheck',
'weblate.trans.checks.chars.BeginNewlineCheck',
'weblate.trans.checks.chars.EndNewlineCheck',
'weblate.trans.checks.chars.BeginSpaceCheck',
'weblate.trans.checks.chars.EndSpaceCheck',
'weblate.trans.checks.chars.EndStopCheck',
'weblate.trans.checks.chars.EndColonCheck',
'weblate.trans.checks.chars.EndQuestionCheck',
'weblate.trans.checks.chars.EndExclamationCheck',
'weblate.trans.checks.chars.EndEllipsisCheck',
'weblate.trans.checks.format.PythonFormatCheck',
'weblate.trans.checks.format.PythonBraceFormatCheck',
'weblate.trans.checks.format.PHPFormatCheck',
'weblate.trans.checks.format.CFormatCheck',
'weblate.trans.checks.consistency.PluralsCheck',
'weblate.trans.checks.consistency.ConsistencyCheck',
'weblate.trans.checks.chars.NewlineCountingCheck',
'weblate.trans.checks.markup.BBCodeCheck',
'weblate.trans.checks.chars.ZeroWidthSpaceCheck',
'weblate.trans.checks.markup.XMLTagsCheck',
'weblate.trans.checks.source.OptionalPluralCheck',
'weblate.trans.checks.source.EllipsisCheck',
'weblate.trans.checks.source.MultipleFailingCheck',
))
# List of automatic fixups
AUTOFIX_LIST = get('AUTOFIX_LIST', (
'trans.autofixes.whitespace.SameBookendingWhitespace',
'trans.autofixes.chars.ReplaceTrailingDotsWithEllipsis',
'trans.autofixes.chars.RemoveZeroSpace',
'weblate.trans.autofixes.whitespace.SameBookendingWhitespace',
'weblate.trans.autofixes.chars.ReplaceTrailingDotsWithEllipsis',
'weblate.trans.autofixes.chars.RemoveZeroSpace',
))
# List of machine translations
MACHINE_TRANSLATION_SERVICES = get('MACHINE_TRANSLATION_SERVICES', (
'trans.machine.weblatetm.WeblateSimilarTranslation',
'trans.machine.weblatetm.WeblateTranslation',
'weblate.trans.machine.weblatetm.WeblateSimilarTranslation',
'weblate.trans.machine.weblatetm.WeblateTranslation',
))
# Whether machine translations are enabled
......
......@@ -10,7 +10,7 @@ These are from django core
<!--
Language names, generated using:
from lang.models import Language
from weblate.lang.models import Language
for l in Language.objects.exclude(name__contains='generated').values_list('name', flat=True).distinct():
print '{%% trans "%s" %%}' % l
......
......@@ -19,7 +19,7 @@
#
from django.contrib import admin
from lang.models import Language
from weblate.lang.models import Language
class LanguageAdmin(admin.ModelAdmin):
......
......@@ -20,7 +20,7 @@
from django.core.management.base import BaseCommand
from optparse import make_option
from lang.models import Language
from weblate.lang.models import Language
class Command(BaseCommand):
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from south.v2 import DataMigration
from lang.models import get_plural_type
from weblate.lang.models import get_plural_type
class Migration(DataMigration):
......
......@@ -22,8 +22,8 @@ from django.db import models
from django.utils.translation import ugettext as _, pgettext_lazy
from django.utils.safestring import mark_safe
from translate.lang.data import languages
from lang import data
from trans.mixins import PercentMixin
from weblate.lang import data
from weblate.trans.mixins import PercentMixin
from south.signals import post_migrate
from django.db.models.signals import post_syncdb
......@@ -278,7 +278,7 @@ def setup_lang(sender, app, **kwargs):
'''
Hook for creating basic set of languages on database migration.
'''
if app == 'lang' or getattr(app, '__name__', '') == 'lang.models':
if app == 'lang' or getattr(app, '__name__', '') == 'weblate.lang.models':
Language.objects.setup(False)
......@@ -426,7 +426,7 @@ class Language(models.Model, PercentMixin):
return self._percents
# Import translations
from trans.models.translation import Translation
from weblate.trans.models.translation import Translation
# Get prercents
result = Translation.objects.get_percents(language=self)
......
......@@ -23,7 +23,7 @@ Tests for language manipulations.
"""
from django.test import TestCase
from lang.models import Language
from weblate.lang.models import Language
from django.core.management import call_command
......
......@@ -21,8 +21,8 @@ from django.shortcuts import render_to_response, get_object_or_404
from django.utils.translation import ugettext as _
from django.template import RequestContext
from django.core.urlresolvers import reverse
from lang.models import Language
from trans.models import Project, Dictionary, Change
from weblate.lang.models import Language
from weblate.trans.models import Project, Dictionary, Change
from urllib import urlencode
......
......@@ -171,7 +171,7 @@ AUTHENTICATION_BACKENDS = (
'social.backends.email.EmailAuth',
#'social.backends.github.GithubOAuth2',
#'social.backends.suse.OpenSUSEOpenId',
'accounts.auth.WeblateUserBackend',
'weblate.accounts.auth.WeblateUserBackend',
)
# Social auth backends setup
......@@ -187,18 +187,19 @@ SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.associate_by_email',
'social.pipeline.social_auth.social_user',
'social.pipeline.user.get_username',
'accounts.pipeline.require_email',
'weblate.accounts.pipeline.require_email',
'social.pipeline.mail.mail_validation',
'social.pipeline.social_auth.associate_by_email',
'accounts.pipeline.verify_open',
'weblate.accounts.pipeline.verify_open',
'social.pipeline.user.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details',
'accounts.pipeline.store_email',
'weblate.accounts.pipeline.store_email',
)
SOCIAL_AUTH_EMAIL_VALIDATION_FUNCTION = 'accounts.pipeline.send_validation'
SOCIAL_AUTH_EMAIL_VALIDATION_FUNCTION = \
'weblate.accounts.pipeline.send_validation'
SOCIAL_AUTH_EMAIL_VALIDATION_URL = '%s/accounts/email-sent/' % URL_PREFIX
SOCIAL_AUTH_LOGIN_ERROR_URL = '%s/accounts/login/' % URL_PREFIX
SOCIAL_AUTH_EMAIL_FORM_URL = '%s/accounts/email/' % URL_PREFIX
......@@ -213,7 +214,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'social.apps.django_app.middleware.SocialAuthExceptionMiddleware',
'accounts.middleware.RequireLoginMiddleware',
'weblate.accounts.middleware.RequireLoginMiddleware',
)
ROOT_URLCONF = 'weblate.urls'
......@@ -238,9 +239,9 @@ INSTALLED_APPS = (
'django.contrib.sitemaps',
'social.apps.django_app.default',
'south',
'trans',
'lang',
'accounts',
'weblate.trans',
'weblate.lang',
'weblate.accounts',
# Needed for javascript localization
'weblate',
)
......@@ -256,12 +257,12 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request',
'django.core.context_processors.csrf',
'django.contrib.messages.context_processors.messages',
'trans.context_processors.weblate_context',
'weblate.trans.context_processors.weblate_context',
)
# Custom exception reporter to include some details
DEFAULT_EXCEPTION_REPORTER_FILTER = \
'trans.debug.WeblateExceptionReporterFilter'
'weblate.trans.debug.WeblateExceptionReporterFilter'
# Default logging of Weblate messages
# - to syslog in production (if available)
......@@ -424,36 +425,36 @@ WHOOSH_INDEX = os.path.join(WEB_ROOT, 'whoosh-index')
# List of quality checks
#CHECK_LIST = (
# 'trans.checks.same.SameCheck',
# 'trans.checks.chars.BeginNewlineCheck',
# 'trans.checks.chars.EndNewlineCheck',
# 'trans.checks.chars.BeginSpaceCheck',
# 'trans.checks.chars.EndSpaceCheck',
# 'trans.checks.chars.EndStopCheck',
# 'trans.checks.chars.EndColonCheck',
# 'trans.checks.chars.EndQuestionCheck',
# 'trans.checks.chars.EndExclamationCheck',
# 'trans.checks.chars.EndEllipsisCheck',
# 'trans.checks.format.PythonFormatCheck',
# 'trans.checks.format.PythonBraceFormatCheck',
# 'trans.checks.format.PHPFormatCheck',
# 'trans.checks.format.CFormatCheck',
# 'trans.checks.consistency.PluralsCheck',
# 'trans.checks.consistency.ConsistencyCheck',
# 'trans.checks.chars.NewlineCountingCheck',
# 'trans.checks.markup.BBCodeCheck',
# 'trans.checks.chars.ZeroWidthSpaceCheck',
# 'trans.checks.markup.XMLTagsCheck',
# 'trans.checks.source.OptionalPluralCheck',
# 'trans.checks.source.EllipsisCheck',
# 'trans.checks.source.MultipleFailingCheck',
# 'weblate.trans.checks.same.SameCheck',
# 'weblate.trans.checks.chars.BeginNewlineCheck',
# 'weblate.trans.checks.chars.EndNewlineCheck',
# 'weblate.trans.checks.chars.BeginSpaceCheck',
# 'weblate.trans.checks.chars.EndSpaceCheck',
# 'weblate.trans.checks.chars.EndStopCheck',
# 'weblate.trans.checks.chars.EndColonCheck',
# 'weblate.trans.checks.chars.EndQuestionCheck',
# 'weblate.trans.checks.chars.EndExclamationCheck',
# 'weblate.trans.checks.chars.EndEllipsisCheck',
# 'weblate.trans.checks.format.PythonFormatCheck',
# 'weblate.trans.checks.format.PythonBraceFormatCheck',
# 'weblate.trans.checks.format.PHPFormatCheck',
# 'weblate.trans.checks.format.CFormatCheck',
# 'weblate.trans.checks.consistency.PluralsCheck',
# 'weblate.trans.checks.consistency.ConsistencyCheck',
# 'weblate.trans.checks.chars.NewlineCountingCheck',
# 'weblate.trans.checks.markup.BBCodeCheck',
# 'weblate.trans.checks.chars.ZeroWidthSpaceCheck',
# 'weblate.trans.checks.markup.XMLTagsCheck',
# 'weblate.trans.checks.source.OptionalPluralCheck',
# 'weblate.trans.checks.source.EllipsisCheck',
# 'weblate.trans.checks.source.MultipleFailingCheck',
#)
# List of automatic fixups
#AUTOFIX_LIST = (
# 'trans.autofixes.whitespace.SameBookendingWhitespace',
# 'trans.autofixes.chars.ReplaceTrailingDotsWithEllipsis',
# 'trans.autofixes.chars.RemoveZeroSpace',
# 'weblate.trans.autofixes.whitespace.SameBookendingWhitespace',
# 'weblate.trans.autofixes.chars.ReplaceTrailingDotsWithEllipsis',
# 'weblate.trans.autofixes.chars.RemoveZeroSpace',
#)
# List of scripts to use in custom processing
......@@ -462,17 +463,17 @@ WHOOSH_INDEX = os.path.join(WEB_ROOT, 'whoosh-index')
# List of machine translations
#MACHINE_TRANSLATION_SERVICES = (
# 'trans.machine.apertium.ApertiumTranslation',
# 'trans.machine.glosbe.GlosbeTranslation',
# 'trans.machine.google.GoogleTranslation',
# 'trans.machine.google.GoogleWebTranslation',
# 'trans.machine.microsoft.MicrosoftTranslation',
# 'trans.machine.mymemory.MyMemoryTranslation',
# 'trans.machine.opentran.OpenTranTranslation',
# 'trans.machine.tmserver.AmagamaTranslation',
# 'trans.machine.tmserver.TMServerTranslation',
# 'trans.machine.weblatetm.WeblateSimilarTranslation',
# 'trans.machine.weblatetm.WeblateTranslation',
# 'weblate.trans.machine.apertium.ApertiumTranslation',
# 'weblate.trans.machine.glosbe.GlosbeTranslation',
# 'weblate.trans.machine.google.GoogleTranslation',
# 'weblate.trans.machine.google.GoogleWebTranslation',
# 'weblate.trans.machine.microsoft.MicrosoftTranslation',
# 'weblate.trans.machine.mymemory.MyMemoryTranslation',
# 'weblate.trans.machine.opentran.OpenTranTranslation',
# 'weblate.trans.machine.tmserver.AmagamaTranslation',
# 'weblate.trans.machine.tmserver.TMServerTranslation',
# 'weblate.trans.machine.weblatetm.WeblateSimilarTranslation',
# 'weblate.trans.machine.weblatetm.WeblateTranslation',
#)
# E-mail address that error messages come from.
......
......@@ -23,6 +23,20 @@
#
from weblate.settings_example import *
import os
if 'TRAVIS_DATABASE' in os.environ:
if os.environ['TRAVIS_DATABASE'] == 'mysql':
DATABASES['default']['ENGINE'] = 'django.db.backends.mysql'
DATABASES['default']['NAME'] = 'weblate'
DATABASES['default']['USER'] = 'root'
DATABASES['default']['PASSWORD'] = ''
elif os.environ['TRAVIS_DATABASE'] == 'postgresql':
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
DATABASES['default']['NAME'] = 'weblate'
DATABASES['default']['USER'] = 'postgres'
DATABASES['default']['PASSWORD'] = ''
# Configure admins
ADMINS = (('Weblate test', 'noreply@weblate.org'), )
......@@ -45,8 +59,8 @@ MT_MYMEMORY_EMAIL = 'test@weblate.org'
# Enable some machine translations
MACHINE_TRANSLATION_SERVICES = (
'trans.machine.microsoft.MicrosoftTranslation',
'trans.machine.dummy.DummyTranslation',
'weblate.trans.machine.microsoft.MicrosoftTranslation',
'weblate.trans.machine.dummy.DummyTranslation',
)
# Silent logging setup
......
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2013 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# Django settings for running testsuite with MySQL database
#
from weblate.settings_test import *
DATABASES['default']['ENGINE'] = 'django.db.backends.mysql'
DATABASES['default']['NAME'] = 'weblate'
DATABASES['default']['USER'] = 'root'
DATABASES['default']['PASSWORD'] = ''
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2013 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# Django settings for running testsuite with PostgreSQL database
#
from weblate.settings_test import *
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
DATABASES['default']['NAME'] = 'weblate'
DATABASES['default']['USER'] = 'postgres'
DATABASES['default']['PASSWORD'] = ''
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2013 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# Django settings for running testsuite with SQLite (the default)
#
from weblate.settings_test import *
......@@ -19,8 +19,8 @@
#
from django.contrib.sitemaps import GenericSitemap, Sitemap
from trans.models import Project, SubProject, Translation
from accounts.models import Profile
from weblate.trans.models import Project, SubProject, Translation
from weblate.accounts.models import Profile
project_dict = {
'queryset': Project.objects.all_acl(None),
......@@ -55,7 +55,7 @@ class PagesSitemap(Sitemap):
return item[0]
def lastmod(self, item):
from trans.models import Change
from weblate.trans.models import Change
return Change.objects.all()[0].timestamp
def priority(self, item):
......
......@@ -49,9 +49,9 @@ def check_versions(sender, app, **kwargs):
'''
Check required versions.
'''
appname = 'trans.models'
if app == 'trans' or getattr(app, '__name__', '') == appname:
from trans.requirements import get_versions, check_version
if (app == 'trans'
or getattr(app, '__name__', '') == 'weblate.trans.models'):
from weblate.trans.requirements import get_versions, check_version
versions = get_versions()
failure = False
......
......@@ -20,7 +20,7 @@
from django.contrib import admin
from django.conf import settings
from trans.models import (
from weblate.trans.models import (
Project, SubProject, Translation, Advertisement,
Unit, Suggestion, Comment, Check, Dictionary, Change
)
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.models import SubProject
from weblate.trans.models import SubProject
from django.contrib.sites.models import Site
from django.template import RequestContext
from django.shortcuts import render_to_response
......@@ -28,8 +28,8 @@ from django.contrib import messages
from django.conf import settings
from weblate import settings_example
from weblate import appsettings
from trans.util import HAS_LIBRAVATAR
from accounts.forms import HAS_ICU
from weblate.trans.util import HAS_LIBRAVATAR
from weblate.accounts.forms import HAS_ICU
import weblate
import django
......
......@@ -23,7 +23,7 @@ a sortable data object so fixes are applied in desired order.
'''
from weblate import appsettings
from trans.util import load_class
from weblate.trans.util import load_class
autofixes = []
for path in appsettings.AUTOFIX_LIST:
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.autofixes.base import AutoFix
from weblate.trans.autofixes.base import AutoFix
from django.utils.translation import ugettext_lazy as _
......
......@@ -20,7 +20,7 @@
import re
from django.utils.translation import ugettext_lazy as _
from trans.autofixes.base import AutoFix
from weblate.trans.autofixes.base import AutoFix
class SameBookendingWhitespace(AutoFix):
......
......@@ -19,7 +19,7 @@
#
from weblate import appsettings
from trans.util import load_class
from weblate.trans.util import load_class
# Initialize checks list
CHECKS = {}
......
......@@ -19,7 +19,7 @@
#
from django.utils.translation import ugettext_lazy as _
from trans.checks.base import TargetCheck, CountingCheck
from weblate.trans.checks.base import TargetCheck, CountingCheck
class BeginNewlineCheck(TargetCheck):
......
......@@ -19,7 +19,7 @@
#
from django.utils.translation import ugettext_lazy as _
from trans.checks.base import TargetCheck
from weblate.trans.checks.base import TargetCheck
class PluralsCheck(TargetCheck):
......@@ -52,7 +52,7 @@ class ConsistencyCheck(TargetCheck):
)
def check(self, sources, targets, unit):
from trans.models import Unit
from weblate.trans.models import Unit
# Do not check consistency if user asked not to have it
if not unit.translation.subproject.allow_translation_propagation:
return False
......
......@@ -19,7 +19,7 @@
#
from django.utils.translation import ugettext_lazy as _
from trans.checks.base import TargetCheck
from weblate.trans.checks.base import TargetCheck
import re
PYTHON_PRINTF_MATCH = re.compile(
......
......@@ -21,7 +21,7 @@
from django.utils.translation import ugettext_lazy as _
from xml.etree import cElementTree
import re
from trans.checks.base import TargetCheck
from weblate.trans.checks.base import TargetCheck
BBCODE_MATCH = re.compile(
r'\[(?P<tag>[^]]*)(?=(@[^]]*)?\](.*?)\[\/(?P=tag)\])',
......
......@@ -19,8 +19,8 @@
#
from django.utils.translation import ugettext_lazy as _
from trans.checks.base import TargetCheck
from trans.checks.format import (
from weblate.trans.checks.base import TargetCheck
from weblate.trans.checks.format import (
PYTHON_PRINTF_MATCH, PHP_PRINTF_MATCH, C_PRINTF_MATCH,
PYTHON_BRACE_MATCH,
)
......
......@@ -19,7 +19,7 @@
#
from django.utils.translation import ugettext_lazy as _
from trans.checks.base import SourceCheck
from weblate.trans.checks.base import SourceCheck
import re
# Matches (s) not followed by alphanumeric chars or at the end
......@@ -68,7 +68,7 @@ class MultipleFailingCheck(SourceCheck):
)
def check_source(self, source, unit):
from trans.models.unitdata import Check
from weblate.trans.models.unitdata import Check
related = Check.objects.filter(
contentsum=unit.contentsum,
project=unit.translation.subproject.project
......
......@@ -21,7 +21,7 @@
import weblate
from weblate import appsettings
from datetime import datetime
from trans.util import get_site_url
from weblate.trans.util import get_site_url
URL_BASE = 'http://weblate.org/?utm_source=weblate&utm_term=%s'
URL_DONATE = 'http://weblate.org/donate/?utm_source=weblate&utm_term=%s'
......
......@@ -22,7 +22,7 @@ Wrapper to include useful information in error mails.
'''
from django.views.debug import SafeExceptionReporterFilter
from trans.requirements import get_versions_string
from weblate.trans.requirements import get_versions_string
class WeblateExceptionReporterFilter(SafeExceptionReporterFilter):
......
......@@ -24,9 +24,11 @@ from django.shortcuts import get_object_or_404
from weblate import appsettings
from django.core.urlresolvers import reverse
from trans.models import Change
from lang.models import Language
from trans.views.helper import get_translation, get_subproject, get_project
from weblate.trans.models import Change
from weblate.lang.models import Language
from weblate.trans.views.helper import (
get_translation, get_subproject, get_project
)
class ChangesFeed(Feed):
......
......@@ -29,7 +29,7 @@ from translate.storage.php import phpunit
from translate.storage.ts2 import tsunit
from translate.storage import mo
from translate.storage import factory
from trans.util import get_string, join_plural
from weblate.trans.util import get_string, join_plural
from translate.misc import quote
import weblate
import subprocess
......
......@@ -25,8 +25,8 @@ from django.utils.translation import (
from django.utils.safestring import mark_safe
from django.utils.encoding import smart_unicode
from django.forms import ValidationError
from lang.models import Language
from trans.models import Unit
from weblate.lang.models import Language
from weblate.trans.models import Unit
from urllib import urlencode
import weblate
......
......@@ -19,7 +19,7 @@
#
from weblate import appsettings
from trans.util import load_class
from weblate.trans.util import load_class
# Initialize checks list
MACHINE_TRANSLATION_SERVICES = {}
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.machine.base import MachineTranslation
from weblate.trans.machine.base import MachineTranslation
from weblate import appsettings
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.machine.base import MachineTranslation
from weblate.trans.machine.base import MachineTranslation
class DummyTranslation(MachineTranslation):
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.machine.base import MachineTranslation
from weblate.trans.machine.base import MachineTranslation
from weblate import appsettings
......
......@@ -18,7 +18,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.machine.base import MachineTranslation, MachineTranslationError
from weblate.trans.machine.base import (
MachineTranslation, MachineTranslationError
)
from django.core.exceptions import ImproperlyConfigured
from weblate import appsettings
......
......@@ -19,7 +19,9 @@
#
from datetime import datetime, timedelta
from trans.machine.base import MachineTranslation, MachineTranslationError
from weblate.trans.machine.base import (
MachineTranslation, MachineTranslationError
)
from django.core.exceptions import ImproperlyConfigured
from weblate import appsettings
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.machine.base import MachineTranslation
from weblate.trans.machine.base import MachineTranslation
from weblate import appsettings
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.machine.base import MachineTranslation
from weblate.trans.machine.base import MachineTranslation
import urllib
from weblate import appsettings
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.machine.base import MachineTranslation
from weblate.trans.machine.base import MachineTranslation
from django.core.exceptions import ImproperlyConfigured
import urllib
......@@ -69,7 +69,7 @@ class TMServerTranslation(MachineTranslation):
self.url,
urllib.quote(appsettings.SOURCE_LANGUAGE),
urllib.quote(language),
urllib.quote(text[:500].encode('utf-8')),
urllib.quote(text[:500].encode('utf-8').replace('\r', ' ')),
)
response = self.json_req(url)
......
......@@ -18,8 +18,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.machine.base import MachineTranslation
from trans.models.unit import Unit
from weblate.trans.machine.base import MachineTranslation
from weblate.trans.models.unit import Unit
def format_unit_match(unit, quality):
......
......@@ -23,7 +23,7 @@ Helper classes for management commands.
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from trans.models import Unit, SubProject, Translation
from weblate.trans.models import Unit, SubProject, Translation
class WeblateCommand(BaseCommand):
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.management.commands import WeblateCommand
from weblate.trans.management.commands import WeblateCommand
class Command(WeblateCommand):
......
......@@ -19,8 +19,8 @@
#
from django.core.management.base import BaseCommand
from trans.models import Suggestion, Comment, Check, Unit, Project
from lang.models import Language
from weblate.trans.models import Suggestion, Comment, Check, Unit, Project
from weblate.lang.models import Language
class Command(BaseCommand):
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.management.commands import WeblateLangCommand
from weblate.trans.management.commands import WeblateLangCommand
from django.utils import timezone
from datetime import timedelta
from optparse import make_option
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.management.commands import WeblateCommand
from weblate.trans.management.commands import WeblateCommand
class Command(WeblateCommand):
......
......@@ -22,9 +22,9 @@ from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q
# In Django 1.5, this should come from django.utils.text
from django.template.defaultfilters import slugify
from trans.models import SubProject, Project
from trans.formats import FILE_FORMATS
from trans.util import is_repo_link
from weblate.trans.models import SubProject, Project
from weblate.trans.formats import FILE_FORMATS
from weblate.trans.util import is_repo_link
from glob import glob
from optparse import make_option
import tempfile
......
......@@ -20,7 +20,7 @@
from django.core.management.base import BaseCommand
from optparse import make_option
from trans.models import Check
from weblate.trans.models import Check
class Command(BaseCommand):
......
......@@ -19,7 +19,7 @@
#
from django.core.management.base import BaseCommand
from trans.requirements import get_versions_string
from weblate.trans.requirements import get_versions_string
class Command(BaseCommand):
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.management.commands import WeblateLangCommand
from weblate.trans.management.commands import WeblateLangCommand
from optparse import make_option
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.management.commands import WeblateCommand
from weblate.trans.management.commands import WeblateCommand
class Command(WeblateCommand):
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.management.commands import WeblateCommand
from weblate.trans.management.commands import WeblateCommand
from optparse import make_option
......
......@@ -18,9 +18,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.management.commands import WeblateCommand
from lang.models import Language
from trans.search import update_index, create_source_index, create_target_index
from weblate.trans.management.commands import WeblateCommand
from weblate.lang.models import Language
from weblate.trans.search import (
update_index, create_source_index, create_target_index
)
from optparse import make_option
......
......@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from trans.management.commands import WeblateCommand
from weblate.trans.management.commands import WeblateCommand
class Command(WeblateCommand):
......
......@@ -19,8 +19,8 @@
#
from django.core.management.base import BaseCommand
from trans.models import IndexUpdate, Unit
from trans.search import update_index
from weblate.trans.models import IndexUpdate, Unit
from weblate.trans.search import update_index
class Command(BaseCommand):
......
This diff is collapsed.
This diff is collapsed.
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