diff options
author | zsloan | 2020-10-02 14:54:09 -0500 |
---|---|---|
committer | zsloan | 2020-10-02 14:54:09 -0500 |
commit | 8c0ab33592e29bf6bae14ba4831dde8a53a27363 (patch) | |
tree | 9078d5b931b39f25a7e58bd6e3da14447471c2ba | |
parent | 5a91ed3bce93934a224d8fbbb7053a1980dd216c (diff) | |
download | genenetwork2-8c0ab33592e29bf6bae14ba4831dde8a53a27363.tar.gz |
Checked if owner_id is "none" to avoid an error when trying to access the resource manager page with newly added datasets
* wqflask/wqflask/resource_manager.py - Only get owner user info conditional on owner_id not being "none" (which it will be by default for newly added datasets). Previously it would throw an error due to "owner_info" being None
-rw-r--r-- | wqflask/wqflask/resource_manager.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/wqflask/wqflask/resource_manager.py b/wqflask/wqflask/resource_manager.py index 39a07310..14ff2183 100644 --- a/wqflask/wqflask/resource_manager.py +++ b/wqflask/wqflask/resource_manager.py @@ -25,16 +25,16 @@ def manage_resource(): group_masks_with_names = get_group_names(group_masks) default_mask = resource_info['default_mask']['data'] owner_id = resource_info['owner_id'] - owner_info = get_user_by_unique_column("user_id", owner_id) - - if 'name' in owner_info: - owner_display_name = owner_info['full_name'] - elif 'user_name' in owner_info: - owner_display_name = owner_info['user_name'] - elif 'email_address' in owner_info: - owner_display_name = owner_info['email_address'] - else: - owner_display_name = None + + owner_display_name = None + if owner_id != "none": + owner_info = get_user_by_unique_column("user_id", owner_id) + if 'name' in owner_info: + owner_display_name = owner_info['full_name'] + elif 'user_name' in owner_info: + owner_display_name = owner_info['user_name'] + elif 'email_address' in owner_info: + owner_display_name = owner_info['email_address'] return render_template("admin/manage_resource.html", owner_name = owner_display_name, resource_id = resource_id, resource_info=resource_info, default_mask=default_mask, group_masks=group_masks_with_names, admin_status=admin_status) |