MCPcopy Index your code
hub / github.com/RustPython/RustPython / EmailPolicy

Class EmailPolicy

Lib/email/policy.py:27–223  ·  view source on GitHub ↗

+ PROVISIONAL The API extensions enabled by this policy are currently provisional. Refer to the documentation for details. This policy adds new header parsing and folding algorithms. Instead of simple strings, headers are custom objects with custom attributes depending on

Source from the content-addressed store, hash-verified

25
26@_extend_docstrings
27class EmailPolicy(Policy):
28
29 """+
30 PROVISIONAL
31
32 The API extensions enabled by this policy are currently provisional.
33 Refer to the documentation for details.
34
35 This policy adds new header parsing and folding algorithms. Instead of
36 simple strings, headers are custom objects with custom attributes
37 depending on the type of the field. The folding algorithm fully
38 implements RFCs 2047 and 5322.
39
40 In addition to the settable attributes listed above that apply to
41 all Policies, this policy adds the following additional attributes:
42
43 utf8 -- if False (the default) message headers will be
44 serialized as ASCII, using encoded words to encode
45 any non-ASCII characters in the source strings. If
46 True, the message headers will be serialized using
47 utf8 and will not contain encoded words (see RFC
48 6532 for more on this serialization format).
49
50 refold_source -- if the value for a header in the Message object
51 came from the parsing of some source, this attribute
52 indicates whether or not a generator should refold
53 that value when transforming the message back into
54 stream form. The possible values are:
55
56 none -- all source values use original folding
57 long -- source values that have any line that is
58 longer than max_line_length will be
59 refolded
60 all -- all values are refolded.
61
62 The default is 'long'.
63
64 header_factory -- a callable that takes two arguments, 'name' and
65 'value', where 'name' is a header field name and
66 'value' is an unfolded header field value, and
67 returns a string-like object that represents that
68 header. A default header_factory is provided that
69 understands some of the RFC5322 header field types.
70 (Currently address fields and date fields have
71 special treatment, while all other fields are
72 treated as unstructured. This list will be
73 completed before the extension is marked stable.)
74
75 content_manager -- an object with at least two methods: get_content
76 and set_content. When the get_content or
77 set_content method of a Message object is called,
78 it calls the corresponding method of this object,
79 passing it the message object as its first argument,
80 and any arguments or keywords that were passed to
81 it as additional arguments. The default
82 content_manager is
83 :data:`~email.contentmanager.raw_data_manager`.
84

Callers 1

policy.pyFile · 0.85

Calls 1

HeaderRegistryClass · 0.90

Tested by

no test coverage detected