From 8c0ab33592e29bf6bae14ba4831dde8a53a27363 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 2 Oct 2020 14:54:09 -0500 Subject: 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 --- wqflask/wqflask/resource_manager.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'wqflask') 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) -- cgit v1.2.3