Commit f7880ca5 authored by Guido van Rossum's avatar Guido van Rossum

- In insertText(), if the expression yields None, insert nothing.

- Added (untested) insertStructure().
parent 95557af5
......@@ -156,7 +156,21 @@ class TALInterpreter:
def do_insertText(self, expr):
text = self.engine.evaluateText(expr)
self.stream.write(str(text))
if text is None:
return
self.stream.write(text)
def do_insertStructure(self, expr):
structure = self.engine.evaluateStructure(expr)
if structure is None:
return
program, macros = TALCompiler(structure)()
saveMacros = self.macros
if macros:
self.macros = saveMacros.copy()
self.macros.update(macros)
self.interpret(program)
self.macros = saveMacros
def do_loop(self, name, expr, block):
iterator = self.engine.setupLoop(name, expr)
......
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