Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(198099)

Side by Side Diff: Doc/library/email.policy.rst

Issue 18761: Fix internal doc references for the email package (Closed)
Patch Set: Created 6 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 :mod:`email.policy`: Policy Objects 1 :mod:`email.policy`: Policy Objects
2 ----------------------------------- 2 -----------------------------------
3 3
4 .. module:: email.policy 4 .. module:: email.policy
5 :synopsis: Controlling the parsing and generating of messages 5 :synopsis: Controlling the parsing and generating of messages
6 6
7 .. moduleauthor:: R. David Murray <rdmurray@bitdance.com> 7 .. moduleauthor:: R. David Murray <rdmurray@bitdance.com>
8 .. sectionauthor:: R. David Murray <rdmurray@bitdance.com> 8 .. sectionauthor:: R. David Murray <rdmurray@bitdance.com>
9 9
10 .. versionadded:: 3.3 10 .. versionadded:: 3.3
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 bytes object rather than a string. 308 bytes object rather than a string.
309 309
310 *value* may contain surrogateescaped binary data. These could be 310 *value* may contain surrogateescaped binary data. These could be
311 converted back into binary data in the returned bytes object. 311 converted back into binary data in the returned bytes object.
312 312
313 313
314 .. class:: Compat32(**kw) 314 .. class:: Compat32(**kw)
315 315
316 This concrete :class:`Policy` is the backward compatibility policy. It 316 This concrete :class:`Policy` is the backward compatibility policy. It
317 replicates the behavior of the email package in Python 3.2. The 317 replicates the behavior of the email package in Python 3.2. The
318 :mod:`policy` module also defines an instance of this class, 318 :mod:`email.policy` module also defines an instance of this class,
r.david.murray 2013/08/16 23:31:43 missing ~.
eric.araujo 2013/08/16 23:45:03 Why not display the full module name?
r.david.murray 2013/08/17 01:04:05 Because I don't anywhere else in the email docs, a
storchaka 2013/08/18 21:39:21 Done.
319 :const:`compat32`, that is used as the default policy. Thus the default 319 :const:`compat32`, that is used as the default policy. Thus the default
320 behavior of the email package is to maintain compatibility with Python 3.2. 320 behavior of the email package is to maintain compatibility with Python 3.2.
321 321
322 The class provides the following concrete implementations of the 322 The class provides the following concrete implementations of the
323 abstract methods of :class:`Policy`: 323 abstract methods of :class:`Policy`:
324 324
325 .. method:: header_source_parse(sourcelines) 325 .. method:: header_source_parse(sourcelines)
326 326
327 The name is parsed as everything up to the '``:``' and returned 327 The name is parsed as everything up to the '``:``' and returned
328 unmodified. The value is determined by stripping leading whitespace off 328 unmodified. The value is determined by stripping leading whitespace off
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 452
453 Source values are split into lines using :meth:`~str.splitlines`. If 453 Source values are split into lines using :meth:`~str.splitlines`. If
454 the value is not to be refolded, the lines are rejoined using the 454 the value is not to be refolded, the lines are rejoined using the
455 ``linesep`` from the policy and returned. The exception is lines 455 ``linesep`` from the policy and returned. The exception is lines
456 containing non-ascii binary data. In that case the value is refolded 456 containing non-ascii binary data. In that case the value is refolded
457 regardless of the ``refold_source`` setting, which causes the binary data 457 regardless of the ``refold_source`` setting, which causes the binary data
458 to be CTE encoded using the ``unknown-8bit`` charset. 458 to be CTE encoded using the ``unknown-8bit`` charset.
459 459
460 .. method:: fold_binary(name, value) 460 .. method:: fold_binary(name, value)
461 461
462 The same as :meth:`fold` if :attr:`cte_type` is ``7bit``, except that 462 The same as :meth:`fold` if :attr:`~Policy.cte_type` is ``7bit``, except t hat
463 the returned value is bytes. 463 the returned value is bytes.
464 464
465 If :attr:`cte_type` is ``8bit``, non-ASCII binary data is converted back 465 If :attr:`~Policy.cte_type` is ``8bit``, non-ASCII binary data is converte d back
466 into bytes. Headers with binary data are not refolded, regardless of the 466 into bytes. Headers with binary data are not refolded, regardless of the
467 ``refold_header`` setting, since there is no way to know whether the 467 ``refold_header`` setting, since there is no way to know whether the
468 binary data consists of single byte characters or multibyte characters. 468 binary data consists of single byte characters or multibyte characters.
469 469
470 The following instances of :class:`EmailPolicy` provide defaults suitable for 470 The following instances of :class:`EmailPolicy` provide defaults suitable for
471 specific application domains. Note that in the future the behavior of these 471 specific application domains. Note that in the future the behavior of these
472 instances (in particular the ``HTTP`` instance) may be adjusted to conform even 472 instances (in particular the ``HTTP`` instance) may be adjusted to conform even
473 more closely to the RFCs relevant to their domains. 473 more closely to the RFCs relevant to their domains.
474 474
475 .. data:: default 475 .. data:: default
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 514
515 From the application view, this means that any header obtained through the 515 From the application view, this means that any header obtained through the
516 :class:`~email.message.Message` is a custom header object with custom 516 :class:`~email.message.Message` is a custom header object with custom
517 attributes, whose string value is the fully decoded unicode value of the 517 attributes, whose string value is the fully decoded unicode value of the
518 header. Likewise, a header may be assigned a new value, or a new header 518 header. Likewise, a header may be assigned a new value, or a new header
519 created, using a unicode string, and the policy will take care of converting 519 created, using a unicode string, and the policy will take care of converting
520 the unicode string into the correct RFC encoded form. 520 the unicode string into the correct RFC encoded form.
521 521
522 The custom header objects and their attributes are described in 522 The custom header objects and their attributes are described in
523 :mod:`~email.headerregistry`. 523 :mod:`~email.headerregistry`.
OLDNEW

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+