diff options
author | BonfaceKilz | 2020-08-27 03:28:43 +0300 |
---|---|---|
committer | BonfaceKilz | 2020-08-27 03:28:43 +0300 |
commit | 70dbeeb5832711ed5271434e482c18bc7ea095b8 (patch) | |
tree | f5d9656ecd3a791e85e3b3acd959e554e07c0047 /wqflask/utility/authentication_tools.py | |
parent | b46faf479e129801f4bec2457444b5341e8aeabf (diff) | |
download | genenetwork2-70dbeeb5832711ed5271434e482c18bc7ea095b8.tar.gz |
Add check for empty group_code when adding a new resource
* wqflask/utility/authentication_tools.py(add_new_resource): If group_code is
"None", an error is thrown when you try to: `group_code + "_" + str(trait_id)`
Diffstat (limited to 'wqflask/utility/authentication_tools.py')
-rw-r--r-- | wqflask/utility/authentication_tools.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/wqflask/utility/authentication_tools.py b/wqflask/utility/authentication_tools.py index 0e499180..73c39399 100644 --- a/wqflask/utility/authentication_tools.py +++ b/wqflask/utility/authentication_tools.py @@ -49,7 +49,10 @@ def add_new_resource(dataset, trait_id=None): } if dataset.type == "Publish": - resource_ob['name'] = get_group_code(dataset) + "_" + str(trait_id) + group_code = get_group_code(dataset) + if group_code is None: + group_code = "" + resource_ob['name'] = group_code + "_" + str(trait_id) resource_ob['data'] = { 'dataset': dataset.id, 'trait' : trait_id @@ -74,7 +77,6 @@ def add_new_resource(dataset, trait_id=None): def get_group_code(dataset): results = g.db.execute("SELECT InbredSetCode from InbredSet where Name='{}'".format(dataset.group.name)).fetchone() - return results[0] def check_admin(resource_id=None): |