From 0abc32d4bc0bbf7a540237265bc2dba12e7457a9 Mon Sep 17 00:00:00 2001 From: Ali Sheikhi Date: Thu, 12 Sep 2024 18:02:31 +0200 Subject: [PATCH 1/2] DD-1640 deposit-create-report script should handle comma separated arguments --- src/datastation/managedeposit/manage_deposit.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/datastation/managedeposit/manage_deposit.py b/src/datastation/managedeposit/manage_deposit.py index 8293804..942c9d8 100644 --- a/src/datastation/managedeposit/manage_deposit.py +++ b/src/datastation/managedeposit/manage_deposit.py @@ -8,8 +8,10 @@ class ManageDeposit: def __init__(self, cmd_args): self.__cmd_args = cmd_args - self.__payload = {'user': cmd_args.user, 'state': cmd_args.state, - 'startdate': cmd_args.startdate, 'enddate': cmd_args.enddate} + self.__payload = {'user': cmd_args.user.split(',') if cmd_args.user is not None else cmd_args.user, + 'state': cmd_args.state.split(',') if cmd_args.state is not None else cmd_args.state, + 'startdate': cmd_args.startdate, + 'enddate': cmd_args.enddate} self.__headers = dict() From dd2f305eaf94c66af94e4d0d64617e778ec1f568 Mon Sep 17 00:00:00 2001 From: Ali Sheikhi Date: Mon, 16 Sep 2024 17:54:59 +0200 Subject: [PATCH 2/2] DD-1640 deposit-create-report script should handle repeatable arguments --- src/datastation/deposit_create_report.py | 4 ++-- src/datastation/managedeposit/manage_deposit.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/datastation/deposit_create_report.py b/src/datastation/deposit_create_report.py index 4e6a49b..1a25fe3 100755 --- a/src/datastation/deposit_create_report.py +++ b/src/datastation/deposit_create_report.py @@ -47,8 +47,8 @@ def main(): help='the file to write the output and send recipient to a to or - for stdout') parser.add_argument('-e', '--enddate', dest='enddate', help='Filter until the record creation of this date') parser.add_argument('-s', '--startdate', dest='startdate', help='Filter from the record creation of this date') - parser.add_argument('-t', '--state', help='The state of the deposit') - parser.add_argument('-u', '--user', dest='user', help='The depositor name') + parser.add_argument('-t', '--state', help='The state of the deposit (repeatable)', action='append') + parser.add_argument('-u', '--user', dest='user', help='The depositor name (repeatable)', action='append') parser.add_argument('-f', '--format', dest='file_format', default='text/csv', help='Output data format') parser.add_argument('-r', '--from', dest='email_from_address', help='from address') parser.add_argument('--email-to', dest='email_to', help='when more than one recipient: comma separated emails') diff --git a/src/datastation/managedeposit/manage_deposit.py b/src/datastation/managedeposit/manage_deposit.py index 942c9d8..1b9033f 100644 --- a/src/datastation/managedeposit/manage_deposit.py +++ b/src/datastation/managedeposit/manage_deposit.py @@ -8,8 +8,8 @@ class ManageDeposit: def __init__(self, cmd_args): self.__cmd_args = cmd_args - self.__payload = {'user': cmd_args.user.split(',') if cmd_args.user is not None else cmd_args.user, - 'state': cmd_args.state.split(',') if cmd_args.state is not None else cmd_args.state, + self.__payload = {'user': cmd_args.user, + 'state': cmd_args.state, 'startdate': cmd_args.startdate, 'enddate': cmd_args.enddate} self.__headers = dict()