ยปCore Development>Code coverage>Lib/email/mime/application.py

Python code coverage for Lib/email/mime/application.py

#countcontent
1n/a# Copyright (C) 2001-2006 Python Software Foundation
2n/a# Author: Keith Dart
3n/a# Contact: email-sig@python.org
4n/a
5n/a"""Class representing application/* type MIME documents."""
6n/a
7n/a__all__ = ["MIMEApplication"]
8n/a
9n/afrom email import encoders
10n/afrom email.mime.nonmultipart import MIMENonMultipart
11n/a
12n/a
13n/aclass MIMEApplication(MIMENonMultipart):
14n/a """Class for generating application/* MIME documents."""
15n/a
16n/a def __init__(self, _data, _subtype='octet-stream',
17n/a _encoder=encoders.encode_base64, *, policy=None, **_params):
18n/a """Create an application/* type MIME document.
19n/a
20n/a _data is a string containing the raw application data.
21n/a
22n/a _subtype is the MIME content type subtype, defaulting to
23n/a 'octet-stream'.
24n/a
25n/a _encoder is a function which will perform the actual encoding for
26n/a transport of the application data, defaulting to base64 encoding.
27n/a
28n/a Any additional keyword arguments are passed to the base class
29n/a constructor, which turns them into parameters on the Content-Type
30n/a header.
31n/a """
32n/a if _subtype is None:
33n/a raise TypeError('Invalid application MIME subtype')
34n/a MIMENonMultipart.__init__(self, 'application', _subtype, policy=policy,
35n/a **_params)
36n/a self.set_payload(_data)
37n/a _encoder(self)