From e325900aaa13f9c279a4acb6da5afd86d31fa3c6 Mon Sep 17 00:00:00 2001 From: Jamie Campbell Date: Tue, 19 Jan 2016 16:14:05 -0600 Subject: [PATCH] the legacy code was using a function lookup that doesn't exist, and wasn't checking for "not none but empty" --- questionnaire/qprocessors/range_or_number.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/questionnaire/qprocessors/range_or_number.py b/questionnaire/qprocessors/range_or_number.py index ee3120e..3689a2c 100644 --- a/questionnaire/qprocessors/range_or_number.py +++ b/questionnaire/qprocessors/range_or_number.py @@ -16,7 +16,9 @@ def question_range_or_number(request, question): #try loading current from database before just setting to min possibledbvalue = get_value_for_run_question(get_runid_from_request(request), question.id) - if not possibledbvalue == None: + + #you can't eval none nor can you eval empty + if not possibledbvalue == None and len(possibledbvalue) > 0: valueaslist = ast.literal_eval(possibledbvalue) current = valueaslist[0] else: @@ -48,7 +50,8 @@ def process_range_or_number(question, answer): ans = answer['ANSWER'] if not ans: - if question.is_required(): + required = question.getcheckdict().get('required', 0) + if required: raise AnswerException(_(u"Field cannot be blank")) else: return []