Skip to content

Commit 92f9af6

Browse files
committed
use set to remove redundant accounts
1 parent 7fb759a commit 92f9af6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

io-met.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ def add_hysds_io(rest_url, metadata):
1818

1919
# copy existing allowed accounts
2020
if doc is not None:
21-
metadata['allowed_accounts'] = list(metadata['allowed_accounts'] +
22-
doc['result'].get('allowed_accounts', []))
21+
merged_accounts = list(set(metadata.get('allowed_accounts', []) +
22+
doc['result'].get('allowed_accounts', [])))
23+
if len(merged_accounts) > 0:
24+
metadata['allowed_accounts'] = merged_accounts
2325

2426
# index
2527
requests_json_response("POST", os.path.join(rest_url ,"hysds_io/add"),

0 commit comments

Comments
 (0)