From feb91dbda13974f84eac52dccdc0de1ddb636616 Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Thu, 30 Apr 2020 10:33:04 +0100 Subject: [PATCH] Used :mimetype: role in various docs. --- .../contributing/writing-documentation.txt | 3 +++ docs/ref/request-response.txt | 2 +- docs/releases/1.11.txt | 4 ++-- docs/releases/1.5.txt | 10 +++++----- docs/releases/1.7.txt | 4 +++- docs/topics/auth/default.txt | 4 ++-- docs/topics/email.txt | 17 +++++++++-------- 7 files changed, 25 insertions(+), 19 deletions(-) diff --git a/docs/internals/contributing/writing-documentation.txt b/docs/internals/contributing/writing-documentation.txt index 91b81e4673..bd9d0e9495 100644 --- a/docs/internals/contributing/writing-documentation.txt +++ b/docs/internals/contributing/writing-documentation.txt @@ -243,6 +243,9 @@ documentation: and try to link to the relevant section if possible. For example, use ``:pep:`20#easter-egg``` or ``:pep:`Easter Egg <20#easter-egg>```. +* Use :rst:role:`:mimetype:` to refer to a MIME Type unless the value + is quoted for a code example. + Django-specific markup ====================== diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 17c0f30335..d53b718020 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -1028,7 +1028,7 @@ can create it with the help of :py:class:`http.HTTPStatus`. For example:: response. It inherits most behavior from its superclass with a couple differences: - Its default ``Content-Type`` header is set to ``application/json``. + Its default ``Content-Type`` header is set to :mimetype:`application/json`. The first parameter, ``data``, should be a ``dict`` instance. If the ``safe`` parameter is set to ``False`` (see below) it can be any diff --git a/docs/releases/1.11.txt b/docs/releases/1.11.txt index f45e7ba38f..805476c348 100644 --- a/docs/releases/1.11.txt +++ b/docs/releases/1.11.txt @@ -275,8 +275,8 @@ Email headers in the local time zone rather than in UTC. * ``EmailMessage.attach()`` and ``attach_file()`` now fall back to MIME type - ``application/octet-stream`` when binary content that can't be decoded as - UTF-8 is specified for a ``text/*`` attachment. + :mimetype:`application/octet-stream` when binary content that can't be + decoded as UTF-8 is specified for a :mimetype:`text/*` attachment. File Storage ~~~~~~~~~~~~ diff --git a/docs/releases/1.5.txt b/docs/releases/1.5.txt index c647464432..553e5156eb 100644 --- a/docs/releases/1.5.txt +++ b/docs/releases/1.5.txt @@ -424,11 +424,11 @@ Non-form data in HTTP requests :attr:`request.POST ` will no longer include data posted via HTTP requests with non form-specific content-types in the header. In prior versions, data posted with content-types other than -``multipart/form-data`` or ``application/x-www-form-urlencoded`` would still -end up represented in the :attr:`request.POST ` -attribute. Developers wishing to access the raw POST data for these cases, -should use the :attr:`request.body ` attribute -instead. +:mimetype:`multipart/form-data` or +:mimetype:`application/x-www-form-urlencoded` would still end up represented in +the :attr:`request.POST ` attribute. Developers +wishing to access the raw POST data for these cases, should use the +:attr:`request.body ` attribute instead. :data:`~django.core.signals.request_finished` signal ---------------------------------------------------- diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt index db3f6720ea..98f6578bba 100644 --- a/docs/releases/1.7.txt +++ b/docs/releases/1.7.txt @@ -557,7 +557,9 @@ Email ~~~~~ * :func:`~django.core.mail.send_mail` now accepts an ``html_message`` - parameter for sending a multipart ``text/plain`` and ``text/html`` email. + parameter for sending a multipart :mimetype:`text/plain` and + :mimetype:`text/html` email. + * The SMTP :class:`~django.core.mail.backends.smtp.EmailBackend` now accepts a ``timeout`` parameter. diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt index be45723bde..343c44084e 100644 --- a/docs/topics/auth/default.txt +++ b/docs/topics/auth/default.txt @@ -1287,8 +1287,8 @@ implementation details see :ref:`using-the-views`. default context data passed to the template. * ``html_email_template_name``: The full name of a template to use - for generating a ``text/html`` multipart email with the password reset - link. By default, HTML email is not sent. + for generating a :mimetype:`text/html` multipart email with the password + reset link. By default, HTML email is not sent. * ``extra_email_context``: A dictionary of context data that will be available in the email template. It can be used to override default diff --git a/docs/topics/email.txt b/docs/topics/email.txt index 46b1bb3ad5..6ea80e44ca 100644 --- a/docs/topics/email.txt +++ b/docs/topics/email.txt @@ -341,15 +341,16 @@ The class has the following methods: message.attach('design.png', img_data, 'image/png') - If you specify a ``mimetype`` of ``message/rfc822``, it will also accept - :class:`django.core.mail.EmailMessage` and :py:class:`email.message.Message`. + If you specify a ``mimetype`` of :mimetype:`message/rfc822`, it will also + accept :class:`django.core.mail.EmailMessage` and + :py:class:`email.message.Message`. - For a ``mimetype`` starting with ``text/``, content is expected to be a - string. Binary data will be decoded using UTF-8, and if that fails, the - MIME type will be changed to ``application/octet-stream`` and the data will - be attached unchanged. + For a ``mimetype`` starting with :mimetype:`text/`, content is expected to + be a string. Binary data will be decoded using UTF-8, and if that fails, + the MIME type will be changed to :mimetype:`application/octet-stream` and + the data will be attached unchanged. - In addition, ``message/rfc822`` attachments will no longer be + In addition, :mimetype:`message/rfc822` attachments will no longer be base64-encoded in violation of :rfc:`2046#section-5.2.1`, which can cause issues with displaying the attachments in `Evolution`__ and `Thunderbird`__. @@ -363,7 +364,7 @@ The class has the following methods: message.attach_file('/images/weather_map.png') - For MIME types starting with ``text/``, binary data is handled as in + For MIME types starting with :mimetype:`text/`, binary data is handled as in ``attach()``. Sending alternative content types