Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

liquid.builtin.tags.for_tag.BreakNode and ContinueNode do not implement children(), causing analyze() to raise #89

Closed
brian-vanderford opened this issue Dec 16, 2022 · 1 comment

Comments

@brian-vanderford
Copy link
Contributor

brian-vanderford commented Dec 16, 2022

>>> from liquid import Environment
>>> Environment().from_string("{% for foo in bar %} {% break %} {% endfor %}").analyze()         
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/brian/src/cloudtruth/conserv/ctcaas/.tox/run/lib/python3.9/site-packages/liquid/template.py", line 284, in analyze
    refs = _TemplateVariableCounter(
  File "/home/brian/src/cloudtruth/conserv/ctcaas/.tox/run/lib/python3.9/site-packages/liquid/template.py", line 622, in analyze
    self._raise_for_failures()
  File "/home/brian/src/cloudtruth/conserv/ctcaas/.tox/run/lib/python3.9/site-packages/liquid/template.py", line 907, in _raise_for_failures
    raise TemplateTraversalError(f"failed visit: {msg}")
liquid.exceptions.TemplateTraversalError: failed visit: BreakNode does not implement a 'children' method
>>> Environment().from_string("{% for foo in bar %} {% continue %} {% endfor %}").analyze()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/brian/src/cloudtruth/conserv/ctcaas/.tox/run/lib/python3.9/site-packages/liquid/template.py", line 284, in analyze
    refs = _TemplateVariableCounter(
  File "/home/brian/src/cloudtruth/conserv/ctcaas/.tox/run/lib/python3.9/site-packages/liquid/template.py", line 622, in analyze
    self._raise_for_failures()
  File "/home/brian/src/cloudtruth/conserv/ctcaas/.tox/run/lib/python3.9/site-packages/liquid/template.py", line 907, in _raise_for_failures
    raise TemplateTraversalError(f"failed visit: {msg}")
liquid.exceptions.TemplateTraversalError: failed visit: ContinueNode does not implement a 'children' method

It looks like they want children methods that return an empty list?

@jg-rp jg-rp closed this as completed in ff877f0 Dec 16, 2022
@jg-rp
Copy link
Owner

jg-rp commented Dec 16, 2022

Thanks @brian-vanderford. Not sure how I managed to miss that.

Fixed in version 1.6.1, now released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants