Comment 0 for bug 982327

Revision history for this message
Alexei M. (estoesyo) wrote :

>>> import tempita
>>> tmp = tempita.HTMLTemplate('{{asd|html}} asdasd')
>>> c = tempita.bunch(asd='<12>')
>>> c.default = None
>>> body = tmp.substitute(c)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/tempita/__init__.py", line 173, in substitute
    result, defs, inherit = self._interpret(ns)
  File "/usr/lib/python3/dist-packages/tempita/__init__.py", line 184, in _interpret
    self._interpret_codes(self._parsed, ns, out=parts, defs=defs)
  File "/usr/lib/python3/dist-packages/tempita/__init__.py", line 212, in _interpret_codes
    self._interpret_code(item, ns, out, defs)
  File "/usr/lib/python3/dist-packages/tempita/__init__.py", line 235, in _interpret_code
    base = func(base)
TypeError: 'NoneType' object is not callable

Using hack:
>>> import tempita
>>> tmp = tempita.HTMLTemplate('{{asd|html}} asdasd')
>>> c = tempita.bunch(asd='<12>')
>>> c.default = None
>>> body = tmp.substitute(c)
>>> print(body)
<12> asdasd