Lines Matching refs:Policy
17 from email._policybase import Policy, compat32
122 def __init__(self, policy=compat32):
123 self.policy = policy
139 def as_string(self, unixfrom=False, maxheaderlen=0, policy=None):
145 if you want a different maxheaderlen. 'policy' is passed to the
147 specified the policy associated with the message instance is used.
154 policy = self.policy if policy is None else policy
159 policy=policy)
168 def as_bytes(self, unixfrom=False, policy=None):
172 header. 'policy' is passed to the BytesGenerator instance used to
173 serialize the message; if not specified the policy associated with
177 policy = self.policy if policy is None else policy
179 g = BytesGenerator(fp, mangle_from_=False, policy=policy)
290 self.policy.handle_defect(self, defect)
401 max_count = self.policy.header_max_count(name)
411 self._headers.append(self.policy.header_store_parse(name, val))
450 return [self.policy.header_fetch_parse(k, v)
461 return [(k, self.policy.header_fetch_parse(k, v))
473 return self.policy.header_fetch_parse(k, v)
512 values.append(self.policy.header_fetch_parse(k, v))
557 self._headers[i] = self.policy.header_store_parse(k, _value)
877 newheaders.append(self.policy.header_store_parse(h, val))
949 def __init__(self, policy=None):
950 if policy is None:
951 from email.policy import default
952 policy = default
953 Message.__init__(self, policy)
956 def as_string(self, unixfrom=False, maxheaderlen=None, policy=None):
961 base Message class, but defaults to None, meaning that the policy value
962 for max_line_length controls the header maximum length. 'policy' is
964 is not specified the policy associated with the message instance is
967 policy = self.policy if policy is None else policy
969 maxheaderlen = policy.max_line_length
970 return super().as_string(maxheaderlen=maxheaderlen, policy=policy)
973 return self.as_string(policy=self.policy.clone(utf8=True))
1088 content_manager = self.policy.content_manager
1093 content_manager = self.policy.content_manager
1112 part = type(self)(policy=self.policy)
1136 part = type(self)(policy=self.policy)