diff --git a/datarequest.py b/datarequest.py index fd81f3252..584b005a5 100644 --- a/datarequest.py +++ b/datarequest.py @@ -2228,8 +2228,7 @@ def datamanager_review_emails(ctx, request_id, datarequest_status): # Get (source data for) email input parameters pm_members = group.members(ctx, GROUP_PM) datamanager_review = json.loads(datarequest_datamanager_review_get(ctx, request_id)) - datamanager_remarks = (datamanager_review['datamanager_remarks'] if 'datamanager_remarks' in - datamanager_review else "") + datamanager_remarks = datamanager_review.get('datamanager_remarks', '') truncated_title = truncated_title_get(ctx, request_id) # Send emails @@ -2302,8 +2301,7 @@ def evaluation_emails(ctx, request_id, datarequest_status): researcher_email = datarequest_owner_get(ctx, request_id) cc = cc_email_addresses_get(datarequest['contact']) evaluation = json.loads(datarequest_evaluation_get(ctx, request_id)) - feedback_for_researcher = (evaluation['feedback_for_researcher'] if 'feedback_for_researcher' in - evaluation else "") + feedback_for_researcher = evaluation.get('feedback_for_researcher', '') pm_email, _ = filter(lambda x: x[0] != "rods", group.members(ctx, GROUP_PM))[0] truncated_title = truncated_title_get(ctx, request_id) diff --git a/groups.py b/groups.py index e07336e08..ace8473e1 100644 --- a/groups.py +++ b/groups.py @@ -406,11 +406,11 @@ def api_group_data(ctx): coll_name = "/{}/home/{}".format(user.zone(ctx), group['name']) group_hierarchy[group['category']][group['subcategory']][group['name']] = { - 'description': group['description'] if 'description' in group else '', + 'description': group.get('description', ''), 'schema_id': group['schema_id'], - 'expiration_date': group['expiration_date'] if 'expiration_date' in group else '', - 'data_classification': group['data_classification'] if 'data_classification' in group else '', - 'creation_date': creation_dates[coll_name] if coll_name in creation_dates else '', + 'expiration_date': group.get('expiration_date', ''), + 'data_classification': group.get('data_classification', ''), + 'creation_date': creation_dates.get(coll_name, ''), 'members': members } @@ -1199,7 +1199,7 @@ def rule_group_sram_sync(ctx): group_name = group["name"] members = group['members'] + group['read'] managers = group['managers'] - description = group['description'] if 'description' in group else '' + description = group.get('description', '') log.write(ctx, "Sync group {} with SRAM".format(group_name))