mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Refs #34140 -- Corrected rst code-block and various formatting issues in docs.
This commit is contained in:
parent
c67ea79aa9
commit
ba755ca131
57 changed files with 443 additions and 269 deletions
|
@ -539,14 +539,14 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004
|
|||
|
||||
from django.utils.functional import keep_lazy, keep_lazy_text
|
||||
|
||||
def fancy_utility_function(s, ...):
|
||||
def fancy_utility_function(s, *args, **kwargs):
|
||||
# Do some conversion on string 's'
|
||||
...
|
||||
fancy_utility_function = keep_lazy(str)(fancy_utility_function)
|
||||
|
||||
# Or more succinctly:
|
||||
@keep_lazy(str)
|
||||
def fancy_utility_function(s, ...):
|
||||
def fancy_utility_function(s, *args, **kwargs):
|
||||
...
|
||||
|
||||
The ``keep_lazy()`` decorator takes a number of extra arguments (``*args``)
|
||||
|
@ -571,12 +571,12 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004
|
|||
|
||||
# Our previous example was:
|
||||
@keep_lazy(str)
|
||||
def fancy_utility_function(s, ...):
|
||||
def fancy_utility_function(s, *args, **kwargs):
|
||||
...
|
||||
|
||||
# Which can be rewritten as:
|
||||
@keep_lazy_text
|
||||
def fancy_utility_function(s, ...):
|
||||
def fancy_utility_function(s, *args, **kwargs):
|
||||
...
|
||||
|
||||
``django.utils.html``
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue