You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The introduction of the dict-like Scope in #305 breaks a pattern I've used for a while, where the template simply echos the pprinted values of locals(). There's a test template here.
It fails with a NotImplementedError because pprint wants to use .items(). Here's a full traceback:
Traceback (most recent call last):
File "/home/mahmoud/projects/clastic/.tox/py37/lib/python3.7/site-packages/chameleon/template.py", line 192, in render
self._render(stream, econtext, rcontext)
File "basic_template_78ff007bbb1662b17c111a0362aff5bd.py", line 152, in render
File "/usr/lib/python3.7/pprint.py", line 58, in pformat
compact=compact).pformat(object)
File "/usr/lib/python3.7/pprint.py", line 144, in pformat
self._format(object, sio, 0, 0, {}, 0)
File "/usr/lib/python3.7/pprint.py", line 161, in _format
rep = self._repr(object, context, level)
File "/usr/lib/python3.7/pprint.py", line 393, in _repr
self._depth, level)
File "/usr/lib/python3.7/pprint.py", line 405, in format
return _safe_repr(object, context, maxlevels, level)
File "/usr/lib/python3.7/pprint.py", line 514, in _safe_repr
vrepr, vreadable, vrecur = saferepr(v, context, maxlevels, level)
File "/usr/lib/python3.7/pprint.py", line 511, in _safe_repr
items = sorted(object.items(), key=_safe_tuple)
File "/home/mahmoud/projects/clastic/.tox/py37/lib/python3.7/site-packages/chameleon/utils.py", line 427, in items
raise NotImplementedError()
NotImplementedError
This fails on Python 3.7-3.9 at least, and chameleon==3.10 through master. (lines in question)
I'm hoping this acts as motivation to implement items(), assuming it's not prohibitively complex.
Thanks again!
The text was updated successfully, but these errors were encountered:
Hey there, long-time fan, first time filer.
The introduction of the dict-like Scope in #305 breaks a pattern I've used for a while, where the template simply echos the pprinted values of
locals()
. There's a test template here.It fails with a
NotImplementedError
becausepprint
wants to use.items()
. Here's a full traceback:This fails on Python 3.7-3.9 at least, and chameleon==3.10 through master. (lines in question)
I'm hoping this acts as motivation to implement
items()
, assuming it's not prohibitively complex.Thanks again!
The text was updated successfully, but these errors were encountered: