summaryrefslogtreecommitdiff
path: root/docs/ref/utils.txt
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-07-04 15:19:33 +0200
committerClaude Paroz <claude@2xlibre.net>2013-07-05 19:30:08 +0200
commita9dd6221af2148410c8a26dcbafd1ff8cc0fb107 (patch)
treebc246344db3a47a6d2340bb6429bd0dbed0f8d20 /docs/ref/utils.txt
parent430aae1b0db9fbcc15415b7bd9a14df1d88359cf (diff)
[1.6.x] Fixed #20224 -- Update docs examples which mention __unicode__
Thanks Marc Tamlyn and Tim Graham for the review. Backport of 7442eb1a24 from master.
Diffstat (limited to 'docs/ref/utils.txt')
-rw-r--r--docs/ref/utils.txt6
1 files changed, 4 insertions, 2 deletions
diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt
index 8d722829fb..15f65c121f 100644
--- a/docs/ref/utils.txt
+++ b/docs/ref/utils.txt
@@ -471,12 +471,14 @@ Atom1Feed
def fancy_utility_function(s, ...):
# Do some conversion on string 's'
...
+ # Replace unicode by str on Python 3
fancy_utility_function = allow_lazy(fancy_utility_function, unicode)
The ``allow_lazy()`` decorator takes, in addition to the function to decorate,
a number of extra arguments (``*args``) specifying the type(s) that the
- original function can return. Usually, it's enough to include ``unicode`` here
- and ensure that your function returns only Unicode strings.
+ original function can return. Usually, it's enough to include ``unicode``
+ (or ``str`` on Python 3) here and ensure that your function returns only
+ Unicode strings.
Using this decorator means you can write your function and assume that the
input is a proper string, then add support for lazy translation objects at the