strange behavior of the bunch

Bug #982327 reported by Alexei M.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-tempita (Ubuntu)
Opinion
Undecided
Unassigned

Bug Description

>>> 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
>>> c.update(tempita.HTMLTemplate.default_namespace)
>>> body = tmp.substitute(c)
>>> print(body)
<12> asdasd

Alexei M. (estoesyo)
description: updated
Alexei M. (estoesyo)
Changed in python-tempita (Ubuntu):
status: New → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.