From 505c45f6f45c7083c4fd73d4863db33b5d573a82 Mon Sep 17 00:00:00 2001 From: Ali Sheikhi Date: Fri, 23 Aug 2024 13:35:58 +0200 Subject: [PATCH] DD-1625 deposit-create-report should doesn't send an empty report --- src/datastation/deposit_create_report.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/datastation/deposit_create_report.py b/src/datastation/deposit_create_report.py index 1dd05a0..c8e5ed3 100755 --- a/src/datastation/deposit_create_report.py +++ b/src/datastation/deposit_create_report.py @@ -17,10 +17,13 @@ def handle_request(self): if output_file == '-': print(report) else: - self.save_report_to_file(report, output_file) + if len(report.split('\n')) > 1: + self.save_report_to_file(report, output_file) - if self.__command_line_args.email_to is not None: - self.send_report_mail(output_file) + if self.__command_line_args.email_to is not None: + self.send_report_mail(output_file) + else: + print("Report is empty.") def save_report_to_file(self, report, output_file): with open(output_file, 'w') as output: