From ea3800375c62929179a2992ca1b892bf213c5831 Mon Sep 17 00:00:00 2001 From: David Sauve Date: Wed, 6 Nov 2019 16:50:52 -0800 Subject: [PATCH] Improved _remove_empty so that it doesn't remove 0, just None --- jsignature/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsignature/utils.py b/jsignature/utils.py index 5138dcf..e5af10a 100644 --- a/jsignature/utils.py +++ b/jsignature/utils.py @@ -15,8 +15,8 @@ def draw_signature(data, as_file=False): 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']))} - + return {'x': list(filter(lambda n: n is not None, pt['x'])), 'y': list(filter(lambda n: n is not None, pt['y']))} + if type(data) is str: drawing = json.loads(data, object_hook=_remove_empty_pts) elif type(data) is list: