From c3a868318f646d38212c74387abeb6827d269907 Mon Sep 17 00:00:00 2001 From: Justin Walgran Date: Fri, 9 Jun 2017 15:40:05 -0700 Subject: [PATCH] Handle null multichoice value There is some data in the production database where the value of a multichoice field audit is the string "null". Adding a None check to the `clean_value` function prevents an exception where code further down in the function expects the value to be iterable. --- opentreemap/treemap/udf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opentreemap/treemap/udf.py b/opentreemap/treemap/udf.py index bb31ab44e..0a6908f79 100644 --- a/opentreemap/treemap/udf.py +++ b/opentreemap/treemap/udf.py @@ -974,6 +974,8 @@ def _validate(val): raise complaint( '%(fieldname)s must be valid JSON', fieldname=self.name) + if values is None: + return None if isinstance(values, basestring): # A single string is valid JSON. Wrap as a list for # consistency