Commit 793a3d3f by Michael DeHaan

More 1.2 templating development; for legacy when_string constructs don't quote the 'in' operator

parent 85099be4
...@@ -155,7 +155,6 @@ def check_conditional(conditional): ...@@ -155,7 +155,6 @@ def check_conditional(conditional):
if not isinstance(conditional, basestring): if not isinstance(conditional, basestring):
return conditional return conditional
try: try:
conditional = conditional.replace("\n", "\\n") conditional = conditional.replace("\n", "\\n")
result = safe_eval(conditional) result = safe_eval(conditional)
...@@ -606,7 +605,7 @@ def compile_when_to_only_if(expression): ...@@ -606,7 +605,7 @@ def compile_when_to_only_if(expression):
# casting is really not needed # casting is really not needed
#tcopy[i] = "%s('''%s''')" % (cast, t) #tcopy[i] = "%s('''%s''')" % (cast, t)
t2 = t.strip() t2 = t.strip()
if (t2[0].isalpha() or t2[0] == '$') and cast == 'str': if (t2[0].isalpha() or t2[0] == '$') and cast == 'str' and t2 != 'in':
tcopy[i] = "'%s'" % (t) tcopy[i] = "'%s'" % (t)
else: else:
tcopy[i] = t tcopy[i] = t
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment