the legacy code was using a function lookup that doesn't exist, and wasn't checking for "not none but empty"

dj111py38
Jamie Campbell 2016-01-19 16:14:05 -06:00
parent 6698319b2c
commit e325900aaa
1 changed files with 5 additions and 2 deletions

View File

@ -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 []