You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While this is a bit of a corner case and could be considered bad form it can sometimes be the most simple solution when you want the rendering of dynamic elements to happen in the backend without having to involve AJAX. You can pass Markup into a HTML attribute just fine, since markupsafe.escape will just pass through Markup unchanged. However this will cause issues if the HTML contains any double quotes.
It's also worth noting that the same thing applies to any object that implements __html__.
It might also be a nice QoL improvement to wrap the return value in Markup, that way it would be possible to pass it into a Markup.format without having to wrap it manually.
While this is a bit of a corner case and could be considered bad form it can sometimes be the most simple solution when you want the rendering of dynamic elements to happen in the backend without having to involve AJAX. You can pass Markup into a HTML attribute just fine, since
markupsafe.escape
will just pass throughMarkup
unchanged. However this will cause issues if the HTML contains any double quotes.It's also worth noting that the same thing applies to any object that implements
__html__
.Actual Behavior
Expected Behavior
Environment
Suggested fix
Rather than doing the following in
html_params
You would do the following
The text was updated successfully, but these errors were encountered: