fold(name, value)
Header folding is controlled by the refold_source
policy setting. A value is considered to be a ‘source value’ if and only if it does not have a name
attribute (having a name
attribute means it is a header object of some sort). If a source value needs to be refolded according to the policy, it is converted into a header object by passing the name and the value with any CR and LF characters removed to the header_factory
. Folding of a header object is done by calling its fold
method with the current policy.
Source values are split into lines using splitlines()
. If the value is not to be refolded, the lines are rejoined using the linesep
from the policy and returned. The exception is lines containing non-ascii binary data. In that case the value is refolded regardless of the refold_source
setting, which causes the binary data to be CTE encoded using the unknown-8bit
charset.
Please login to continue.