Re: [Django] #34595: format_html() should explicitely mention format_string is not escaped and that result is safe (was: format_html() should explicitely mention format_string is not escaped.)

3 views
Skip to first unread message

Django

unread,
May 24, 2023, 4:40:26 PM5/24/23
to django-...@googlegroups.com
#34595: format_html() should explicitely mention format_string is not escaped and
that result is safe
--------------------------------------+------------------------------------
Reporter: Natalia Bidart | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Template system | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Description changed by Natalia Bidart:

Old description:

> The docs for `format_html` mention that `args` and `kwargs` are escaped
> but it does not say anything about `format_string` (which is, in fact,
> not escaped). Readers could benefit from this clarification to avoid
> putting unsafe content in `format_string`.

New description:

The docs for `format_html` mention that `args` and `kwargs` are escaped
but it does not say anything about `format_string` (which is, in fact, not
escaped). Readers could benefit from this clarification to avoid putting
unsafe content in `format_string`.

Similarly, the docs could be extended to explicitly mention that the
result is marked as safe. Mariusz suggested this text (thanks!):

{{{
The output has :func:`~django.utils.safestring.mark_safe` applied.
}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/34595#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Reply all
Reply to author
Forward
0 new messages