Filter out null values in signature data
Null values in the signature data will cause the compute box calculation to fail. Filter them out during json.loads
This commit is contained in:
committed by
Sébastien Corbin
parent
9e81795f99
commit
a42a9ca543
@@ -14,9 +14,11 @@ def draw_signature(data, as_file=False):
|
||||
`data` can be a json object (list in fact) or a json string
|
||||
if `as_file` is True, a temp file is returned instead of Image instance
|
||||
"""
|
||||
def _remove_empty_pts(pt):
|
||||
return {'x': list(filter(None, pt['x'])), 'y': list(filter(None, pt['y']))}
|
||||
|
||||
if type(data) is str:
|
||||
drawing = json.loads(data)
|
||||
drawing = json.loads(data, object_hook=_remove_empty_pts)
|
||||
elif type(data) is list:
|
||||
drawing = data
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user