summaryrefslogtreecommitdiff
path: root/docs/ref/utils.txt
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-05-14 19:06:31 -0400
committerTim Graham <timograham@gmail.com>2016-05-14 19:07:39 -0400
commitdbd72b850b487be37df2940d16697a2d57b73ac6 (patch)
tree30783948c9aeb6216d5a43a3a9919b1b00af6d13 /docs/ref/utils.txt
parent936a7df6520941e264f741766281fc00e4709a2d (diff)
[1.9.x] Refs #26021 -- Used hanging indentation in some doc examples.
Backport of e475e849703d937e158e75e7a6d9cb99090857f6 from master
Diffstat (limited to 'docs/ref/utils.txt')
-rw-r--r--docs/ref/utils.txt22
1 files changed, 14 insertions, 8 deletions
diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt
index 3d6b792263..7afa4504cc 100644
--- a/docs/ref/utils.txt
+++ b/docs/ref/utils.txt
@@ -323,7 +323,7 @@ Sample usage::
>>> feed.add_item(
... title="Hello",
... link="http://www.holovaty.com/test/",
- ... description="Testing."
+ ... description="Testing.",
... )
>>> with open('test.rss', 'w') as fp:
... feed.write(fp, 'utf-8')
@@ -601,15 +601,19 @@ escaping HTML.
So, instead of writing::
- mark_safe("%s <b>%s</b> %s" % (some_html,
- escape(some_text),
- escape(some_other_text),
- ))
+ mark_safe("%s <b>%s</b> %s" % (
+ some_html,
+ escape(some_text),
+ escape(some_other_text),
+ ))
You should instead use::
format_html("{} <b>{}</b> {}",
- mark_safe(some_html), some_text, some_other_text)
+ mark_safe(some_html),
+ some_text,
+ some_other_text,
+ )
This has the advantage that you don't need to apply :func:`escape` to each
argument and risk a bug and an XSS vulnerability if you forget one.
@@ -630,8 +634,10 @@ escaping HTML.
``args_generator`` should be an iterator that returns the sequence of
``args`` that will be passed to :func:`format_html`. For example::
- format_html_join('\n', "<li>{} {}</li>", ((u.first_name, u.last_name)
- for u in users))
+ format_html_join(
+ '\n', "<li>{} {}</li>",
+ ((u.first_name, u.last_name) for u in users)
+ )
.. function:: strip_tags(value)