]> git.parisson.com Git - teleforma.git/commitdiff
Show alert message when a ccontent is in the error folder : https://trackers.pilotsys...
authorYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 12 Jul 2023 12:39:30 +0000 (14:39 +0200)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 12 Jul 2023 12:39:30 +0000 (14:39 +0200)
teleforma/management/commands/teleforma-export-avis.py

index eb098bbc801cc46e7bfafea7db5dcfdadefe2941..cb090d81f683438a711bd771c2841f5a8826871f 100644 (file)
@@ -172,6 +172,12 @@ class Command(BaseCommand):
                 # convert StringIO to BytesIO
                 bytes_output = io.BytesIO(output.getvalue().encode('utf-8'))
                 ftp.storbinary("STOR export-orders%s.csv" % str(date.today()), bytes_output)
+
+                # check existence of file in "errors" folder
+                ftp.cwd(self.FTP_PATH + '/error')
+                files = ftp.nlst()
+                if files:
+                    self.log("Error : there's a file in the FTP 'error' directory. Something went wrong in the last export. Please check the error file on the FTP.")
                 ftp.quit()
             except:
                 ftp.close()
@@ -185,4 +191,4 @@ class Command(BaseCommand):
                 settings.DEFAULT_FROM_EMAIL,
                 settings.REPORT_TO_EMAIL,
                 fail_silently=False,
-            )
+            )
\ No newline at end of file