summaryrefslogtreecommitdiff
path: root/Doc/library/smtpd.rst
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-05-16 09:36:31 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2016-05-16 09:36:31 +0300
commitcbcc2fd641de178e139b59f0c08bb738e9d4835e (patch)
tree55971f5445b543fc501569be3c3d8c914d02545b /Doc/library/smtpd.rst
parent4ecfa455ae47bd955857348238c8bf8476819a1e (diff)
downloadcpython-git-cbcc2fd641de178e139b59f0c08bb738e9d4835e.tar.gz
Issue #27033: The default value of the decode_data parameter for
smtpd.SMTPChannel and smtpd.SMTPServer constructors is changed to False.
Diffstat (limited to 'Doc/library/smtpd.rst')
-rw-r--r--Doc/library/smtpd.rst50
1 files changed, 27 insertions, 23 deletions
diff --git a/Doc/library/smtpd.rst b/Doc/library/smtpd.rst
index 977f9a8748..2466e38f11 100644
--- a/Doc/library/smtpd.rst
+++ b/Doc/library/smtpd.rst
@@ -29,7 +29,7 @@ SMTPServer Objects
.. class:: SMTPServer(localaddr, remoteaddr, data_size_limit=33554432,\
- map=None, enable_SMTPUTF8=False, decode_data=True)
+ map=None, enable_SMTPUTF8=False, decode_data=False)
Create a new :class:`SMTPServer` object, which binds to local address
*localaddr*. It will treat *remoteaddr* as an upstream SMTP relayer. It
@@ -45,20 +45,19 @@ SMTPServer Objects
global socket map is used.
*enable_SMTPUTF8* determins whether the ``SMTPUTF8`` extension (as defined
- in :RFC:`6531`) should be enabled. The default is ``False``. If set to
- ``True``, *decode_data* must be ``False`` (otherwise an error is raised).
+ in :RFC:`6531`) should be enabled. The default is ``False``.
When ``True``, ``SMTPUTF8`` is accepted as a parameter to the ``MAIL``
command and when present is passed to :meth:`process_message` in the
- ``kwargs['mail_options']`` list.
+ ``kwargs['mail_options']`` list. *decode_data* and *enable_SMTPUTF8*
+ cannot be set to ``True`` at the same time.
*decode_data* specifies whether the data portion of the SMTP transaction
- should be decoded using UTF-8. The default is ``True`` for backward
- compatibility reasons, but will change to ``False`` in Python 3.6; specify
- the keyword value explicitly to avoid the :exc:`DeprecationWarning`. When
- *decode_data* is set to ``False`` the server advertises the ``8BITMIME``
+ should be decoded using UTF-8. The default is ``False``. When
+ *decode_data* is not set to ``True`` the server advertises the ``8BITMIME``
extension (:rfc:`6152`), accepts the ``BODY=8BITMIME`` parameter to
the ``MAIL`` command, and when present passes it to :meth:`process_message`
- in the ``kwargs['mail_options']`` list.
+ in the ``kwargs['mail_options']`` list. *decode_data* and *enable_SMTPUTF8*
+ cannot be set to ``True`` at the same time.
.. method:: process_message(peer, mailfrom, rcpttos, data, **kwargs)
@@ -71,13 +70,12 @@ SMTPServer Objects
format).
If the *decode_data* constructor keyword is set to ``True``, the *data*
- argument will be a unicode string. If it is set to ``False``, it
+ parameter will be a unicode string. If it is set to ``False``, it
will be a bytes object.
*kwargs* is a dictionary containing additional information. It is empty
- unless at least one of ``decode_data=False`` or ``enable_SMTPUTF8=True``
- was given as an init parameter, in which case it contains the following
- keys:
+ if ``decode_data=True`` was given as an init argument, otherwise
+ it contains the following keys:
*mail_options*:
a list of all received parameters to the ``MAIL``
@@ -108,10 +106,13 @@ SMTPServer Objects
*localaddr* and *remoteaddr* may now contain IPv6 addresses.
.. versionadded:: 3.5
- the *decode_data* and *enable_SMTPUTF8* constructor arguments, and the
- *kwargs* argument to :meth:`process_message` when one or more of these is
+ The *decode_data* and *enable_SMTPUTF8* constructor parameters, and the
+ *kwargs* parameter to :meth:`process_message` when one or more of these is
specified.
+ .. versionchanged:: 3.6
+ *decode_data* is now ``False`` by default.
+
DebuggingServer Objects
-----------------------
@@ -150,7 +151,7 @@ SMTPChannel Objects
-------------------
.. class:: SMTPChannel(server, conn, addr, data_size_limit=33554432,\
- map=None, enable_SMTPUTF8=False, decode_data=True)
+ map=None, enable_SMTPUTF8=False, decode_data=False)
Create a new :class:`SMTPChannel` object which manages the communication
between the server and a single SMTP client.
@@ -162,22 +163,25 @@ SMTPChannel Objects
limit.
*enable_SMTPUTF8* determins whether the ``SMTPUTF8`` extension (as defined
- in :RFC:`6531`) should be enabled. The default is ``False``. A
- :exc:`ValueError` is raised if both *enable_SMTPUTF8* and *decode_data* are
- set to ``True`` at the same time.
+ in :RFC:`6531`) should be enabled. The default is ``False``.
+ *decode_data* and *enable_SMTPUTF8* cannot be set to ``True`` at the same
+ time.
A dictionary can be specified in *map* to avoid using a global socket map.
*decode_data* specifies whether the data portion of the SMTP transaction
- should be decoded using UTF-8. The default is ``True`` for backward
- compatibility reasons, but will change to ``False`` in Python 3.6. Specify
- the keyword value explicitly to avoid the :exc:`DeprecationWarning`.
+ should be decoded using UTF-8. The default is ``False``.
+ *decode_data* and *enable_SMTPUTF8* cannot be set to ``True`` at the same
+ time.
To use a custom SMTPChannel implementation you need to override the
:attr:`SMTPServer.channel_class` of your :class:`SMTPServer`.
.. versionchanged:: 3.5
- the *decode_data* and *enable_SMTPUTF8* arguments were added.
+ The *decode_data* and *enable_SMTPUTF8* parameters were added.
+
+ .. versionchanged:: 3.6
+ *decode_data* is now ``False`` by default.
The :class:`SMTPChannel` has the following instance variables: