Closed eternicode closed 4 months ago
WithNode.render
has lost a bit of code related to the second argument (value
) and Promises. I'm not familiar enough with the codebase to say for sure, but looking through the rest of the code, I couldn't find any solid evidence that this second argument is ever actually passed in normal usage.
After spending a bit more time in the code, I get what this argument and the promise-related code did. I've added a commit that handles values that resolve to Promises.
Related note: There seem to be 0 tests related to variables/filters resolving to promises...
This is a great addition, thanks! The explicit global is the only remaining issue -- I can definitely handle the style fixes.
Done and done.
Implements the new
with
tag syntax{% with x=y %}
while keeping old-style syntax{% with y as x %}
intact (since Django 1.3).A lot of this (mainly the new
token_kwargs
utility function) has been ported straight from the appropriate django sources.Concerns:
token_kwargs
; a newtags/util.js
might make more sense, but the function is also only used intags/with.js
. Happy to move it if you have a preferred / more appropriate place for it.See comment below.WithNode.render
has lost a bit of code related to the second argument (value
) and Promises. I'm not familiar enough with the codebase to say for sure, but looking through the rest of the code, I couldn't find any solid evidence that this second argument is ever actually passed in normal usage.FWIW, this implementation works for my templates which, at the moment, use a combination of old-style and new-style
with
tags.Also, concerning code style, I didn't see any style guide, and there is no linter config in the repo, so I may have botched some style :grin:. I tried to follow existing conventions, but I'm happy to tweak specific things if you'll point them out.