Commit 6c9dc740 authored by Michal Čihař's avatar Michal Čihař

Fix indentation in managements commands

parent df11a4a4
......@@ -22,20 +22,25 @@ from django.core.management.base import BaseCommand
from optparse import make_option
from weblate.accounts.models import create_groups, move_users
class Command(BaseCommand):
help = 'setups default groups'
help = 'setups default user groups'
option_list = BaseCommand.option_list + (
make_option('--move',
make_option(
'--move',
action='store_true',
dest='move',
default=False,
help='Move all users to Users group'),
make_option('--no-update',
help='Move all users to Users group'
),
make_option(
'--no-update',
action='store_false',
dest='update',
default=True,
help='Prevents updates to existing group definitions'),
)
help='Prevents updates to existing group definitions'
),
)
def handle(self, *args, **options):
'''
......
......@@ -22,16 +22,19 @@ from django.core.management.base import BaseCommand
from optparse import make_option
from weblate.lang.models import Language
class Command(BaseCommand):
help = 'Populates language definitions'
option_list = BaseCommand.option_list + (
make_option('--no-update',
make_option(
'--no-update',
action='store_false',
dest='update',
default=True,
help='Prevents updates to existing language definitions'),
)
help='Prevents updates to existing language definitions'
),
)
def handle(self, *args, **options):
'''
......
......@@ -20,6 +20,7 @@
from weblate.trans.management.commands import WeblateCommand
class Command(WeblateCommand):
help = 'checks status of git repo'
......
......@@ -23,24 +23,27 @@ from django.utils import timezone
from datetime import timedelta
from optparse import make_option
class Command(WeblateCommand):
help = 'commits pending changes older than given age'
option_list = WeblateCommand.option_list + (
make_option('--age',
make_option(
'--age',
action='store',
type='int',
dest='age',
default=24,
help='Age of changes to commit in hours (default is 24 hours)'
),
make_option('--lang',
make_option(
'--lang',
action='store',
type='string',
dest='lang',
default=None,
help='Limit only to given languages (comma separated list)'
),
)
)
def handle(self, *args, **options):
......@@ -55,7 +58,7 @@ class Command(WeblateCommand):
translations = subproject.translation_set.all()
else:
translations = subproject.translation_set.filter(
language_code__in = langs
language_code__in=langs
)
for translation in translations:
......
......@@ -20,6 +20,7 @@
from weblate.trans.management.commands import WeblateCommand
class Command(WeblateCommand):
help = 'forces commiting changes to git repo'
......
......@@ -21,27 +21,30 @@
from weblate.trans.management.commands import WeblateCommand
from optparse import make_option
class Command(WeblateCommand):
help = '(re)loads translations from disk'
option_list = WeblateCommand.option_list + (
make_option('--force',
make_option(
'--force',
action='store_true',
dest='force',
default=False,
help='Force rereading files even when they should be up to date'
),
make_option('--lang',
make_option(
'--lang',
action='store',
type='string',
dest='lang',
default=None,
help='Limit only to given languages (comma separated list)'
),
)
)
def handle(self, *args, **options):
langs = None
if options['lang'] is not None:
langs = options['lang'].split(',')
for s in self.get_subprojects(*args, **options):
s.create_translations(options['force'], langs)
for subproject in self.get_subprojects(*args, **options):
subproject.create_translations(options['force'], langs)
......@@ -28,12 +28,14 @@ from optparse import make_option
class Command(WeblateCommand):
help = 'rebuilds index for fulltext search'
option_list = WeblateCommand.option_list + (
make_option('--clean',
make_option(
'--clean',
action='store_true',
dest='clean',
default=False,
help='removes also all words from database'),
)
help='removes also all words from database'
),
)
def handle(self, *args, **options):
languages = Language.objects.all()
......
......@@ -45,12 +45,16 @@ class Command(BaseCommand):
for lang in languages:
with FULLTEXT_INDEX.target_writer(lang=lang.code, buffered=False) as writer:
for update in base.filter(unit__translation__language =
lang).exclude(unit__target='').iterator():
units = base.filter(
unit__translation__language=lang
).exclude(
unit__target=''
)
for update in units.iterator():
Unit.objects.add_to_target_index(
update.unit.checksum,
update.unit.target,
writer)
writer
)
base.delete()
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