From d6c44a0c0908c8cbaba97a5af9b9c93bd1ee1b4a Mon Sep 17 00:00:00 2001 From: Al Date: Sun, 3 Jul 2016 23:42:13 -0400 Subject: [PATCH] [fix] alternatives lists in config utils --- scripts/geodata/configs/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/geodata/configs/utils.py b/scripts/geodata/configs/utils.py index 5063ca61..33e6d470 100644 --- a/scripts/geodata/configs/utils.py +++ b/scripts/geodata/configs/utils.py @@ -33,7 +33,7 @@ def nested_get(obj, keys, default=DoesNotExist): def alternative_probabilities(properties): if properties is None: - return None + return None, None probs = [] alternatives = [] @@ -43,11 +43,13 @@ def alternative_probabilities(properties): props = properties['default'] probs.append(prob) alternatives.append(props) - elif 'alternatives' not in properties: + elif 'alternatives' not in properties and 'default' in properties: prob = 1.0 props = properties['default'] probs.append(prob) alternatives.append(props) + elif 'alternatives' not in properties and 'default' not in properties: + return None, None alts = properties.get('alternatives', []) for alt in alts: