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

Simplify code

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 6bda764a
......@@ -608,7 +608,11 @@ def auto_translation(request, project, subproject, lang):
translation.commit_pending(request)
autoform = AutoForm(translation, request.user, request.POST)
change = None
if not translation.subproject.locked and autoform.is_valid():
if translation.subproject.locked or not autoform.is_valid():
messages.error(request, _('Failed to process form!'))
return redirect(translation)
if autoform.cleaned_data['inconsistent']:
units = translation.unit_set.filter_type(
'inconsistent', translation
......@@ -659,8 +663,6 @@ def auto_translation(request, project, subproject, lang):
unit.save_backend(request, False, False)
messages.success(request, _('Automatic translation completed.'))
else:
messages.error(request, _('Failed to process form!'))
return redirect(translation)
......
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