Skip to content

Commit 2002ed1

Browse files
author
Thomas Goodwin
committed
Added safer way to fetch value in case 'undefined' was sent from the client (which JavaScript eliminates the key if this happen)
1 parent 09ca006 commit 2002ed1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

rest/helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,14 @@ def _handle_value(val):
124124
if type(v) == dict:
125125
if type(out_val) == list:
126126
out_val = {} # Change to map
127-
out_val.update({v['id']: _handle_value(v['value'])})
127+
out_val.update({v['id']: _handle_value(v.get('value', None))})
128128
else:
129129
out_val.append(v)
130130
return out_val
131131

132132
props_dict = {}
133133
for prop in properties:
134-
props_dict[prop['id']] = _handle_value(prop['value'])
134+
props_dict[prop['id']] = _handle_value(prop.get('value', None))
135135
return props_dict
136136

137137
###############################################

0 commit comments

Comments
 (0)