aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/trait.py
diff options
context:
space:
mode:
authorzsloan2020-12-07 14:22:54 -0600
committerzsloan2020-12-07 14:22:54 -0600
commitd0a3db3851bc2895a8775b1dc7c01a92f9c8c85c (patch)
treef4cd674d99db81ca6d45c2b360bfcc856f4e08af /wqflask/base/trait.py
parentd76bb8ed8fb7a015e7563f64b6b3d6760cf874d8 (diff)
downloadgenenetwork2-d0a3db3851bc2895a8775b1dc7c01a92f9c8c85c.tar.gz
Changed the logic in create_trait so that permissions should always be set, and added an assert that 'name' is passed instead of using if/else, since it should always be passed
Diffstat (limited to 'wqflask/base/trait.py')
-rw-r--r--wqflask/base/trait.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index ec8c40a0..50bd8874 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -25,19 +25,19 @@ def create_trait(**kw):
assert bool(kw.get('dataset')) != bool(
kw.get('dataset_name')), "Needs dataset ob. or name"
- if kw.get('name'):
- if kw.get('dataset_name'):
- if kw.get('dataset_name') != "Temp":
- dataset = create_dataset(kw.get('dataset_name'))
- else:
- dataset = kw.get('dataset')
+ assert bool(kw.get('name')), "Needs trait name"
+ if kw.get('dataset_name'):
if kw.get('dataset_name') != "Temp":
- if dataset.type == 'Publish':
- permissions = check_resource_availability(
- dataset, kw.get('name'))
- else:
- permissions = check_resource_availability(dataset)
+ dataset = create_dataset(kw.get('dataset_name'))
+ else:
+ dataset = kw.get('dataset')
+
+ if dataset.type == 'Publish':
+ permissions = check_resource_availability(
+ dataset, kw.get('name'))
+ else:
+ permissions = check_resource_availability(dataset)
if "view" in permissions['data']:
the_trait = GeneralTrait(**kw)