This is a fix on top of the 'airplane variable upgrade' commits that fixes legacy when_string so it evaluates correctly in the new eval construct.

pull/2623/head
Michael DeHaan 12 years ago
parent 3e58768344
commit a05361f515

@ -66,7 +66,6 @@ def _executor_hook(job_queue, result_queue):
return_data = multiprocessing_runner._executor(host)
result_queue.put(return_data)
# print "FLAGS=%s" % return_data.flags
if 'LEGACY_TEMPLATE_WARNING' in return_data.flags:
# pass data back up across the multiprocessing fork boundary
template.Flags.LEGACY_TEMPLATE_WARNING = True

@ -601,12 +601,18 @@ def compile_when_to_only_if(expression):
cast = 'float'
tcopy = tokens[1:]
for (i,t) in enumerate(tokens[1:]):
if t.find("$") != -1:
# final variable substitution will happen in Runner code
tcopy[i] = "%s('''%s''')" % (cast, t)
#if re.search(t, r"^\w"):
# bare word will turn into Jinja2 so all the above
# casting is really not needed
#tcopy[i] = "%s('''%s''')" % (cast, t)
t2 = t.strip()
if (t2[0].isalpha() or t2[0] == '$') and cast == 'str':
tcopy[i] = "'%s'" % (t)
else:
tcopy[i] = t
return " ".join(tcopy)
result = " ".join(tcopy)
return result
# when_boolean
elif tokens[0] in [ 'bool', 'boolean' ]:

Loading…
Cancel
Save