diff options
author | BonfaceKilz | 2022-07-04 15:22:54 +0300 |
---|---|---|
committer | BonfaceKilz | 2022-07-04 15:37:52 +0300 |
commit | 4fd21d4c55e064c8d98b0ba6577f156cc669c852 (patch) | |
tree | b4f1eab5a0cbc1a14c56a7a0cd82a901ee1b9056 | |
parent | c1c5ab5ba940e2b48c9568a6c1d34ccae4d17d7a (diff) | |
download | genenetwork2-4fd21d4c55e064c8d98b0ba6577f156cc669c852.tar.gz |
wqflask: use the raw user string if value is non-existent in redis
* wqflask/wqflask/metadata_edits.py (_get_diffs): If a user---whose
value is extracted from Redis and encoded in the file name---doesn't
exist in Redis, use the raw string extracted from the file.
-rw-r--r-- | wqflask/wqflask/metadata_edits.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py index 5468fe9b..4b960072 100644 --- a/wqflask/wqflask/metadata_edits.py +++ b/wqflask/wqflask/metadata_edits.py @@ -62,13 +62,16 @@ def _get_diffs( ): def __get_file_metadata(file_name: str) -> Dict: author, resource_id, time_stamp, *_ = file_name.split(".") - + try: + author = json.loads(redis_conn.hget("users", author)).get( + "full_name" + ) + except (AttributeError, TypeError): + author = author return { "resource_id": resource_id, "file_name": file_name, - "author": json.loads(redis_conn.hget("users", author)).get( - "full_name" - ), + "author": author, "time_stamp": time_stamp, "roles": get_highest_user_access_role( resource_id=resource_id, |