2012-04-15 14:21:09 |
Alexei M. |
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
>>> body = tmp.substitute(c)
>>> print(body)
<12> asdasd |
>>> 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 |
|