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

LiquidTypeError when comparing strings #141

Closed
jg-rp opened this issue Jan 27, 2024 · 0 comments · Fixed by #142
Closed

LiquidTypeError when comparing strings #141

jg-rp opened this issue Jan 27, 2024 · 0 comments · Fixed by #142
Labels
bug Something isn't working

Comments

@jg-rp
Copy link
Owner

jg-rp commented Jan 27, 2024

Boolean expressions - found in {% if %} and {% unless %} tags - that compare string values with <, <=, > and >= are raising a LiquidTypeError exception.

Comparing strings for equality is OK, but comparing the lexicographic order of strings is broken.

from liquid import Template

t = Template("{% if x <= y %}TRUE{% else %}FALSE{% endif %}")
t.render(x="abc", y="def")
# LiquidTypeError: unknown operator: <class 'str'> < <class 'str'>, on line 1
@jg-rp jg-rp added the bug Something isn't working label Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant