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) return_data = multiprocessing_runner._executor(host)
result_queue.put(return_data) result_queue.put(return_data)
# print "FLAGS=%s" % return_data.flags
if 'LEGACY_TEMPLATE_WARNING' in return_data.flags: if 'LEGACY_TEMPLATE_WARNING' in return_data.flags:
# pass data back up across the multiprocessing fork boundary # pass data back up across the multiprocessing fork boundary
template.Flags.LEGACY_TEMPLATE_WARNING = True template.Flags.LEGACY_TEMPLATE_WARNING = True

@ -601,12 +601,18 @@ def compile_when_to_only_if(expression):
cast = 'float' cast = 'float'
tcopy = tokens[1:] tcopy = tokens[1:]
for (i,t) in enumerate(tokens[1:]): for (i,t) in enumerate(tokens[1:]):
if t.find("$") != -1: #if re.search(t, r"^\w"):
# final variable substitution will happen in Runner code # bare word will turn into Jinja2 so all the above
tcopy[i] = "%s('''%s''')" % (cast, t) # 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: else:
tcopy[i] = t tcopy[i] = t
return " ".join(tcopy) result = " ".join(tcopy)
return result
# when_boolean # when_boolean
elif tokens[0] in [ 'bool', 'boolean' ]: elif tokens[0] in [ 'bool', 'boolean' ]:

Loading…
Cancel
Save