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 <195869163+bluerosej@users.noreply.github.com>
There was a problem hiding this comment.
@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() | ||
| } |
| @@ -0,0 +1,91 @@ | |||
| # Import libraries for JinjaRenderer | |||
There was a problem hiding this comment.
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.
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 <195869163+bluerosej@users.noreply.github.com>
@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 <195869163+bluerosej@users.noreply.github.com>