From 894651e5ce84854374a80c5c1ea66de05743b013 Mon Sep 17 00:00:00 2001 From: Johann Kellerman Date: Tue, 20 Sep 2016 20:56:23 +0200 Subject: [PATCH 1/2] Handle non-subscriptable path inhumanize_error --- voluptuous/humanize.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/voluptuous/humanize.py b/voluptuous/humanize.py index ba35023..4b18f75 100644 --- a/voluptuous/humanize.py +++ b/voluptuous/humanize.py @@ -12,6 +12,8 @@ def _nested_getitem(data, path): except (KeyError, IndexError): # The index is not present in the dictionary, list or other indexable return None + except TypeError: # data is not subscriptable + break return data From a30f47fbe74b572d81040c231c792dcba2802611 Mon Sep 17 00:00:00 2001 From: Johann Kellerman Date: Tue, 20 Sep 2016 23:36:36 +0200 Subject: [PATCH 2/2] Consistent --- voluptuous/humanize.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/voluptuous/humanize.py b/voluptuous/humanize.py index 4b18f75..91ab201 100644 --- a/voluptuous/humanize.py +++ b/voluptuous/humanize.py @@ -9,11 +9,10 @@ def _nested_getitem(data, path): for item_index in path: try: data = data[item_index] - except (KeyError, IndexError): - # The index is not present in the dictionary, list or other indexable + except (KeyError, IndexError, TypeError): + # The index is not present in the dictionary, list or other + # indexable or data is not subscriptable return None - except TypeError: # data is not subscriptable - break return data