-
Notifications
You must be signed in to change notification settings - Fork 8
feat/jinja #18
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
base: main
Are you sure you want to change the base?
feat/jinja #18
Conversation
bluerosej
commented
Oct 8, 2025
- Created Jinja template for index.html
- Set up main.py to render index.html w/ Jinja
- Modified JinjaRenderer to not convert values to strings if list or dict in JinjaRenderer.py
…injaRenderer to not convert values to strings if list or dict in JinjaRenderer.py
@bluerosej discovered that Air's Jinja rendering system is stringifying everything. She also provided a fix in pyladiesmanila/VoicesOfPyLadiesManila#18. We expand on that excellent fix by constraining it to just stringify BaseTag-inherited items so that Jinja can operate normally. Co-Authored-By: Rose J <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bluerosej I essentially copied your fix basically right into core Air in this PR. The change I made was to constrain context to just stringify Air Tags and add formal tests, but otherwise it is identical.
For that reason I shared co-author credits on the commit. And am sharing credit for the PR with you.
If you ever want to contribute directly to Air, I'm happy to assist you in any ticket that interests you. 😄
I also invite you to the Air Discord, where me, @audreyfeldroy, and others chat about Air. (It is easier to discuss tickets there than in PR comments)
| context = { | ||
| k: v if isinstance(v, (list, dict)) else str(v) for k, v in context.items() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done! 💪🏻
| @@ -0,0 +1,91 @@ | |||
| # Import libraries for JinjaRenderer | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Traditionally in Python files are named in snake_case rather than PascalCase. This follows the PEP8 standard.
| from air.requests import Request | ||
|
|
||
|
|
||
| # Copied from: https://github.com/feldroy/air/blob/main/src/air/templating.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the attribution to core Air. Not everyone does that. 🙏🏻
Hi @pydanny, thanks for fixing the bug and for sharing credit! Okay, I will explore Air some more and see if there are any open issues I can work on later on. Thanks for the invite! 😄 |
@bluerosej discovered that Air's Jinja rendering system is stringifying everything. She also provided a fix in pyladiesmanila/VoicesOfPyLadiesManila#18. We expand on that excellent fix by constraining it to just stringify BaseTag-inherited items so that Jinja can operate normally. Co-Authored-By: Rose J <[email protected]>
@bluerosej discovered that Air's Jinja rendering system is stringifying everything. She also provided a fix in pyladiesmanila/VoicesOfPyLadiesManila#18. We expand on that excellent fix by constraining it to just stringify BaseTag-inherited items so that Jinja can operate normally. Co-Authored-By: Rose J <[email protected]>