From d849dfb65d27aef31c0271540bc14654e81551e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Fri, 21 Oct 2022 16:21:46 -0300 Subject: [PATCH] =?UTF-8?q?Exclui=20diret=C3=B3rio=20ao=20fim=20do=20proce?= =?UTF-8?q?ssamento?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/servicos/jobs/daily/sincroniza_rancher.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sigi/apps/servicos/jobs/daily/sincroniza_rancher.py b/sigi/apps/servicos/jobs/daily/sincroniza_rancher.py index 33919eb..921194f 100644 --- a/sigi/apps/servicos/jobs/daily/sincroniza_rancher.py +++ b/sigi/apps/servicos/jobs/daily/sincroniza_rancher.py @@ -1,7 +1,7 @@ import datetime import docutils.core import json -from pathlib import Path +import shutil from django.conf import settings from django.core.mail import mail_admins from django.template.loader import render_to_string @@ -30,7 +30,9 @@ class Job(DailyJob): generate_instance_name(o): o for o in Orgao.objects.filter(tipo__legislativo=True) } - print(f"\t{len(self._nomes_gerados)} órgãos que podem ter instâncias.") + print( + _(f"\t{len(self._nomes_gerados)} órgãos que podem ter instâncias.") + ) for tipo in TipoServico.objects.filter(modo="H").exclude( tipo_rancher="" @@ -43,7 +45,12 @@ class Job(DailyJob): end="", ) self.process(tipo) - print(f" Término: {datetime.datetime.now():%H:%M:%S}.") + print(_(f" Término: {datetime.datetime.now():%H:%M:%S}.")) + + try: + shutil.rmtree(settings.HOSPEDAGEM_PATH) + except Exception as e: + print(_(f"Erro ao excluir diretório {settings.HOSPEDAGEM_PATH}")) print("Relatório final:\n================") self.report()