Commit 79870bdc authored by Michal Čihař's avatar Michal Čihař

Simplify imports

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent ad35a15b
......@@ -36,6 +36,7 @@ from weblate.trans.filelock import FileLock
from weblate.trans.util import is_repo_link
from weblate.trans.util import get_site_url
from weblate.trans.util import sleep_while_git_locked
from weblate.trans.models.translation import Translation
from weblate.trans.validators import (
validate_repoweb, validate_filemask,
validate_extra_file, validate_autoaccept,
......@@ -43,6 +44,8 @@ from weblate.trans.validators import (
)
from weblate.lang.models import Language
from weblate.appsettings import SCRIPT_CHOICES
from weblate.accounts.models import notify_merge_failure
from weblate.trans.models.changes import Change
def validate_repo(val):
......@@ -718,7 +721,6 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
Sends out notifications on merge failure.
'''
# Notify subscribed users about failure
from weblate.accounts.models import notify_merge_failure
notify_merge_failure(self, error, status)
def update_branch(self, request=None):
......@@ -787,7 +789,6 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
'''
Loads translations from git.
'''
from weblate.trans.models.translation import Translation
translations = []
for path in self.get_mask_matches():
code = self.get_lang_code(path)
......@@ -1175,7 +1176,6 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
'''
Returns date of last change done in Weblate.
'''
from weblate.trans.models.changes import Change
try:
change = Change.objects.content().filter(
translation__subproject=self
......@@ -1200,8 +1200,6 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
'''
Creates new language file.
'''
from weblate.trans.models.translation import Translation
if self.project.new_lang != 'add':
raise ValueError('Not supported operation!')
......
......@@ -47,6 +47,8 @@ from weblate.trans.util import (
from weblate.accounts.avatar import get_user_display
from weblate.trans.mixins import URLMixin, PercentMixin
from weblate.trans.boolean_sum import BooleanSum
from weblate.accounts.models import notify_new_string
from weblate.trans.models.changes import Change
class TranslationManager(models.Manager):
......@@ -491,7 +493,6 @@ class Translation(models.Model, URLMixin, PercentMixin):
'''
Checks whether database is in sync with git and possibly does update.
'''
from weblate.trans.models.changes import Change
if change is None:
change = Change.ACTION_UPDATE
......@@ -595,7 +596,6 @@ class Translation(models.Model, URLMixin, PercentMixin):
# Notify subscribed users
if was_new:
from weblate.accounts.models import notify_new_string
notify_new_string(self)
@property
......@@ -1138,8 +1138,6 @@ class Translation(models.Model, URLMixin, PercentMixin):
'''
Merges translate-toolkit store into current translation.
'''
from weblate.trans.models.changes import Change
# Merge with lock acquired
with self.subproject.git_lock:
......
......@@ -31,7 +31,9 @@ from weblate.trans.models.source import Source
from weblate.trans.models.unitdata import Check, Comment, Suggestion
from weblate.trans.models.changes import Change
from weblate.trans.search import update_index_unit, fulltext_search, more_like
from weblate.accounts.models import (
notify_new_contributor, notify_new_translation
)
from weblate.trans.filelock import FileLockException
from weblate.trans.util import (
is_plural, split_plural, join_plural, get_distinct_translations
......@@ -509,8 +511,6 @@ class Unit(models.Model):
Optional user parameters defines authorship of a change.
"""
from weblate.accounts.models import notify_new_translation
# Update lock timestamp
self.translation.update_lock(request)
......@@ -606,8 +606,6 @@ class Unit(models.Model):
"""
Creates Change entry for saving unit.
"""
from weblate.accounts.models import notify_new_contributor
# Notify about new contributor
user_changes = Change.objects.filter(
translation=self.translation,
......
......@@ -25,6 +25,7 @@ from weblate.lang.models import Language
from weblate.trans.checks import CHECKS
from weblate.trans.models.changes import Change
from weblate.accounts.avatar import get_user_display
from weblate.accounts.models import notify_new_suggestion, notify_new_comment
class RelatedUnitMixin(object):
......@@ -52,7 +53,6 @@ class SuggestionManager(models.Manager):
'''
Creates new suggestion for this unit.
'''
from weblate.accounts.models import notify_new_suggestion
if not request.user.is_authenticated():
user = None
......@@ -224,8 +224,6 @@ class CommentManager(models.Manager):
'''
Adds comment to this unit.
'''
from weblate.accounts.models import notify_new_comment
new_comment = self.create(
user=user,
contentsum=unit.contentsum,
......
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