-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
StrictDefaultUndefined not working #57
Comments
Hi hardiksondagar, Sorry about that. For now, please try this definition of class StrictDefaultUndefined(StrictUndefined):
def __getattribute__(self, name: str) -> object:
if name in (
"__repr__",
"__liquid__",
"__class__",
"name",
"hint",
"obj",
"msg",
):
return object.__getattribute__(self, name)
raise UndefinedError(object.__getattribute__(self, "msg"))
from liquid import Environment
from liquid import StrictDefaultUndefined
env = Environment(undefined=StrictDefaultUndefined, tolerance=Mode.STRICT)
template = env.from_string('Hello {{ username | default: "user" }}')
print(template.render()) output
|
Python Liquid version 1.4.0 has been release. It includes More generally, |
Thanks @jg-rp. |
Code
Output
After changing this code to the following seems to fix the issue. Though I have no idea if it's a right place to add these lines.
The text was updated successfully, but these errors were encountered: