[damned-lies] fix: ensure django.po exists before extracting code str
- From: Guillaume Bernard <gbernard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] fix: ensure django.po exists before extracting code str
- Date: Fri, 9 Jul 2021 17:55:49 +0000 (UTC)
commit 718e046b6c854c439f249077bff4772dae5d6dd5
Author: Guillaume Bernard <associations guillaume-bernard fr>
Date: Fri Jul 9 19:54:35 2021 +0200
fix: ensure django.po exists before extracting code str
stats/management/commands/update-trans.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/stats/management/commands/update-trans.py b/stats/management/commands/update-trans.py
index 643fde57..c1d1d729 100644
--- a/stats/management/commands/update-trans.py
+++ b/stats/management/commands/update-trans.py
@@ -33,11 +33,13 @@ class Command(BaseCommand):
self._update_django_po_with_code_strings()
# backup code-only strings in the code.po file. Remove non code related msgid (mainly coming
from database)
- code_po_file = str(self.locale_dir / "code.po")
- shutil.copy(str(self.locale_dir / "django.po"), code_po_file)
- subprocess.run(
- ["/usr/bin/msgattrib", "--no-obsolete", "-o", str(code_po_file), str(code_po_file)],
check=True
- )
+ django_po_file = self.locale_dir / "django.po"
+ if django_po_file.is_file():
+ code_po_file = self.locale_dir / "code.po"
+ shutil.copy(django_po_file, code_po_file)
+ subprocess.run(
+ ["/usr/bin/msgattrib", "--no-obsolete", "-o", str(code_po_file), str(code_po_file)],
check=True
+ )
self._update_django_po_with_database_strings()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]