From: Yoan Le Clanche Date: Mon, 8 Mar 2021 09:20:06 +0000 (+0100) Subject: reactivate mail and ftp X-Git-Tag: 2.8.1-pro~169 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=cf0fe3cf532a0e0a67d2ef878290665df5c82d37;p=teleforma.git reactivate mail and ftp --- diff --git a/teleforma/management/commands/teleforma-export-avis.py b/teleforma/management/commands/teleforma-export-avis.py index 2d9a17c2..72b65cf6 100644 --- a/teleforma/management/commands/teleforma-export-avis.py +++ b/teleforma/management/commands/teleforma-export-avis.py @@ -153,22 +153,22 @@ class Command(BaseCommand): self.log('Sending csv to ftp...') - # ftp = FTP(self.FTP_HOST) - # try: - # ftp.login(self.FTP_LOGIN, self.FTP_PASSWORD) - # ftp.cwd(self.FTP_PATH) - # ftp.storlines("STOR export-orders%s.csv" % str(date.today()), output) - # ftp.quit() - # except: - # ftp.close() - # self.log('Error while uploading to FTP') - # raise - # self.log('Sending csv to ftp done') - - # send_mail( - # "Rapport export d'avis", - # self.logs, - # settings.DEFAULT_FROM_EMAIL, - # settings.REPORT_TO_EMAIL, - # fail_silently=False, - # ) + ftp = FTP(self.FTP_HOST) + try: + ftp.login(self.FTP_LOGIN, self.FTP_PASSWORD) + ftp.cwd(self.FTP_PATH) + ftp.storlines("STOR export-orders%s.csv" % str(date.today()), output) + ftp.quit() + except: + ftp.close() + self.log('Error while uploading to FTP') + raise + self.log('Sending csv to ftp done') + + send_mail( + "Rapport export d'avis", + self.logs, + settings.DEFAULT_FROM_EMAIL, + settings.REPORT_TO_EMAIL, + fail_silently=False, + )