Products.MIMETools


NameProducts.MIMETools JSON
Version 4.0 PyPI version JSON
download
home_pagehttps://github.com/zopefoundation/Products.MIMETools
SummaryMIMETools provides the ``dtml-mime`` tag for DocumentTemplate.
upload_time2023-02-01 08:58:14
maintainer
docs_urlNone
authorZope Foundation and Contributors
requires_python>=3.7
licenseZPL 2.1
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://github.com/zopefoundation/Products.MIMETools/actions/workflows/tests.yml/badge.svg
        :target: https://github.com/zopefoundation/Products.MIMETools/actions/workflows/tests.yml

.. image:: https://coveralls.io/repos/github/zopefoundation/Products.MIMETools/badge.svg
        :target: https://coveralls.io/github/zopefoundation/Products.MIMETools

.. image:: https://img.shields.io/pypi/v/Products.MIMETools.svg
        :target: https://pypi.org/project/Products.MIMETools/
        :alt: Current version on PyPI

.. image:: https://img.shields.io/pypi/pyversions/Products.MIMETools.svg
        :target: https://pypi.org/project/Products.MIMETools/
        :alt: Supported Python versions

Products.MIMETools
==================

Currently, the MIMETools product's only function is to provide the
``<dtml-mime>`` DTML tag for the DocumentTemplate distribution.

The ``<dtml-mime>`` tag is used to construct MIME containers. The syntax of the
``<dtml-mime>`` tag is::

  <dtml-mime type="x" disposition="y" encode="z">
  Contents of first part
  <dtml-boundary type="x" disposition="y" encode="z">
  Contents of second part
  <dtml-boundary type="x" disposition="y" encode="z">
  Contents of nth part
  </dtml-mime>

The area of data between tags, called a block, is encoded into whatever is
specified with the 'encode' tag attribute for that block. If no encoding is
specified, 'base64' is defaulted. Valid encoding options include 'base64',
'quoted-printable' and '7bit' . If the 'encode' attribute is set to '7bit'
no encoding is done on the block and the data is assumed to be in a valid MIME
format.

If the 'disposition' attribute is not specified for a certain block, then the
'Content-Disposition:' MIME header is not included in that block's MIME part.

The entire MIME container, from the opening mime tag to the closing, has it's
'Content-Type:' MIME header set to 'multipart/mixed'.

For example, the following DTML::

  <dtml-mime encode="7bit" type="text/plain">
  This is the first part.
  <dtml-boundary encode="base64" type="text/plain">
  This is the second.
  </dtml-mime>

Is rendered to the following text::

  Content-Type: multipart/mixed;
      boundary="216.164.72.30.501.1550.923070182.795.22531"

  --216.164.72.30.501.1550.923070182.795.22531
  Content-Type: text/plain
  Content-Transfer-Encoding: 7bit

  This is the first part.

  --216.164.72.30.501.1550.923070182.795.22531
  Content-Type: text/plain
  Content-Transfer-Encoding: base64

  VGhpcyBpcyB0aGUgc2Vjb25kLgo=

  --216.164.72.30.501.1550.923070182.795.22531--

The ``dtml-mime`` tag is particularly handy in conjunction with the
``dtml-sendmail`` tag.  This allows Zope to send attachments along with email.
Here is an example.

Create a DTML method called 'input' with the following code::

  <dtml-var standard_html_header>
  <form method="post" action="send" ENCTYPE="multipart/form-data">
  <input type="file" name="afile"><br>
  Send to:<input type="textbox" name="who"/><br/>
  <input type="submit" value="Send"/>
  </form>
  <dtml-var standard_html_footer>

Create another DTML Method called 'send' with the following code::

  <dtml-var standard_html_header>
  <dtml-sendmail smtphost="localhost">
  From: michel@digicool.com
  To: <dtml-var who>
  <dtml-mime type="text/plain" encode="7bit">

  Hi <dtml-var who>, someone sent you this attachment.

  <dtml-boundary type="application/octet-stream" disposition="attachment"
  encode="base64"><dtml-var "afile.read()"></dtml-mime>

  </dtml-sendmail>

  Mail with attachment was sent.
  <dtml-var standard_html_footer>


Notice that there is no blank line between the 'To:' header and the starting
``dtml-mime`` tag. If a blank line is inserted between them then the message
will not be interpreted as multipart by the receiving mail reader.

Also notice that there is no newline between the ``dtml-boundary`` tag and the
``dtml-var`` tag, or the end of the ``dtml-var`` tag and the closing
``dtml-mime`` tag. This is important, if you break the tags up with newlines
then they will be encoded and included in the MIME part, which is probably not
what you want.

As per the MIME spec, ``dtml-mime`` tags may be nested within ``dtml-mime``
tags arbitrarily.

Changelog
=========

4.0 (2023-02-01)
----------------

- Drop support for Python 2.7, 3.5, 3.6.


3.3 (2022-12-16)
----------------
- Fix insidious buildout configuration bug for tests against Zope 4.

- Add support for Python 3.10 and 3.11.


3.2 (2021-03-16)
----------------
- Add support for Python 3.9.


3.1 (2020-02-11)
----------------
- Fix linting.

- Change some imports to prevent DeprecationWarnings.


3.0 (2019-05-20)
----------------
- Reimplemented using Python's ``email`` module.

- Added support for Python 3.5, 3.6, 3.7 and 3.8.

- Switched documentation to standard ``dtml`` notation.

- Added ``tox`` testing configuration.

- Full linting.

- Boosted test coverage to over 90%.

- Compatible with DocumentTemplate 3.x and Zope 4.


2.13.0 (2010-07-10)
-------------------
- PEP8 cleanup and added basic tests.

- Released as separate package.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zopefoundation/Products.MIMETools",
    "name": "Products.MIMETools",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Zope Foundation and Contributors",
    "author_email": "zope-dev@zope.dev",
    "download_url": "https://files.pythonhosted.org/packages/1f/08/e7131c6a5a4f7991ad863f685475639eddc0fd18036485bb2bbbc6f7d013/Products.MIMETools-4.0.tar.gz",
    "platform": null,
    "description": ".. image:: https://github.com/zopefoundation/Products.MIMETools/actions/workflows/tests.yml/badge.svg\n        :target: https://github.com/zopefoundation/Products.MIMETools/actions/workflows/tests.yml\n\n.. image:: https://coveralls.io/repos/github/zopefoundation/Products.MIMETools/badge.svg\n        :target: https://coveralls.io/github/zopefoundation/Products.MIMETools\n\n.. image:: https://img.shields.io/pypi/v/Products.MIMETools.svg\n        :target: https://pypi.org/project/Products.MIMETools/\n        :alt: Current version on PyPI\n\n.. image:: https://img.shields.io/pypi/pyversions/Products.MIMETools.svg\n        :target: https://pypi.org/project/Products.MIMETools/\n        :alt: Supported Python versions\n\nProducts.MIMETools\n==================\n\nCurrently, the MIMETools product's only function is to provide the\n``<dtml-mime>`` DTML tag for the DocumentTemplate distribution.\n\nThe ``<dtml-mime>`` tag is used to construct MIME containers. The syntax of the\n``<dtml-mime>`` tag is::\n\n  <dtml-mime type=\"x\" disposition=\"y\" encode=\"z\">\n  Contents of first part\n  <dtml-boundary type=\"x\" disposition=\"y\" encode=\"z\">\n  Contents of second part\n  <dtml-boundary type=\"x\" disposition=\"y\" encode=\"z\">\n  Contents of nth part\n  </dtml-mime>\n\nThe area of data between tags, called a block, is encoded into whatever is\nspecified with the 'encode' tag attribute for that block. If no encoding is\nspecified, 'base64' is defaulted. Valid encoding options include 'base64',\n'quoted-printable' and '7bit' . If the 'encode' attribute is set to '7bit'\nno encoding is done on the block and the data is assumed to be in a valid MIME\nformat.\n\nIf the 'disposition' attribute is not specified for a certain block, then the\n'Content-Disposition:' MIME header is not included in that block's MIME part.\n\nThe entire MIME container, from the opening mime tag to the closing, has it's\n'Content-Type:' MIME header set to 'multipart/mixed'.\n\nFor example, the following DTML::\n\n  <dtml-mime encode=\"7bit\" type=\"text/plain\">\n  This is the first part.\n  <dtml-boundary encode=\"base64\" type=\"text/plain\">\n  This is the second.\n  </dtml-mime>\n\nIs rendered to the following text::\n\n  Content-Type: multipart/mixed;\n      boundary=\"216.164.72.30.501.1550.923070182.795.22531\"\n\n  --216.164.72.30.501.1550.923070182.795.22531\n  Content-Type: text/plain\n  Content-Transfer-Encoding: 7bit\n\n  This is the first part.\n\n  --216.164.72.30.501.1550.923070182.795.22531\n  Content-Type: text/plain\n  Content-Transfer-Encoding: base64\n\n  VGhpcyBpcyB0aGUgc2Vjb25kLgo=\n\n  --216.164.72.30.501.1550.923070182.795.22531--\n\nThe ``dtml-mime`` tag is particularly handy in conjunction with the\n``dtml-sendmail`` tag.  This allows Zope to send attachments along with email.\nHere is an example.\n\nCreate a DTML method called 'input' with the following code::\n\n  <dtml-var standard_html_header>\n  <form method=\"post\" action=\"send\" ENCTYPE=\"multipart/form-data\">\n  <input type=\"file\" name=\"afile\"><br>\n  Send to:<input type=\"textbox\" name=\"who\"/><br/>\n  <input type=\"submit\" value=\"Send\"/>\n  </form>\n  <dtml-var standard_html_footer>\n\nCreate another DTML Method called 'send' with the following code::\n\n  <dtml-var standard_html_header>\n  <dtml-sendmail smtphost=\"localhost\">\n  From: michel@digicool.com\n  To: <dtml-var who>\n  <dtml-mime type=\"text/plain\" encode=\"7bit\">\n\n  Hi <dtml-var who>, someone sent you this attachment.\n\n  <dtml-boundary type=\"application/octet-stream\" disposition=\"attachment\"\n  encode=\"base64\"><dtml-var \"afile.read()\"></dtml-mime>\n\n  </dtml-sendmail>\n\n  Mail with attachment was sent.\n  <dtml-var standard_html_footer>\n\n\nNotice that there is no blank line between the 'To:' header and the starting\n``dtml-mime`` tag. If a blank line is inserted between them then the message\nwill not be interpreted as multipart by the receiving mail reader.\n\nAlso notice that there is no newline between the ``dtml-boundary`` tag and the\n``dtml-var`` tag, or the end of the ``dtml-var`` tag and the closing\n``dtml-mime`` tag. This is important, if you break the tags up with newlines\nthen they will be encoded and included in the MIME part, which is probably not\nwhat you want.\n\nAs per the MIME spec, ``dtml-mime`` tags may be nested within ``dtml-mime``\ntags arbitrarily.\n\nChangelog\n=========\n\n4.0 (2023-02-01)\n----------------\n\n- Drop support for Python 2.7, 3.5, 3.6.\n\n\n3.3 (2022-12-16)\n----------------\n- Fix insidious buildout configuration bug for tests against Zope 4.\n\n- Add support for Python 3.10 and 3.11.\n\n\n3.2 (2021-03-16)\n----------------\n- Add support for Python 3.9.\n\n\n3.1 (2020-02-11)\n----------------\n- Fix linting.\n\n- Change some imports to prevent DeprecationWarnings.\n\n\n3.0 (2019-05-20)\n----------------\n- Reimplemented using Python's ``email`` module.\n\n- Added support for Python 3.5, 3.6, 3.7 and 3.8.\n\n- Switched documentation to standard ``dtml`` notation.\n\n- Added ``tox`` testing configuration.\n\n- Full linting.\n\n- Boosted test coverage to over 90%.\n\n- Compatible with DocumentTemplate 3.x and Zope 4.\n\n\n2.13.0 (2010-07-10)\n-------------------\n- PEP8 cleanup and added basic tests.\n\n- Released as separate package.\n",
    "bugtrack_url": null,
    "license": "ZPL 2.1",
    "summary": "MIMETools provides the ``dtml-mime`` tag for DocumentTemplate.",
    "version": "4.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ee4732433b32bae9e3e1d901a88738278cf2636b227d055241c06272813bceb",
                "md5": "74d5335347ba1ed7555de154524ce4c1",
                "sha256": "290b0535a32e6a7c9c77b45673095b233fec6451c940f0d8e90f85edb23c58fb"
            },
            "downloads": -1,
            "filename": "Products.MIMETools-4.0-py3-none-any.whl",
            "has_sig": true,
            "md5_digest": "74d5335347ba1ed7555de154524ce4c1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9702,
            "upload_time": "2023-02-01T08:58:10",
            "upload_time_iso_8601": "2023-02-01T08:58:10.875819Z",
            "url": "https://files.pythonhosted.org/packages/8e/e4/732433b32bae9e3e1d901a88738278cf2636b227d055241c06272813bceb/Products.MIMETools-4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1f08e7131c6a5a4f7991ad863f685475639eddc0fd18036485bb2bbbc6f7d013",
                "md5": "89280af9b43353d67f7e267a7feb7f18",
                "sha256": "1b8af3a1eced479799321e7c62a49ed6b14b2361ea24e124497e8307a006caa2"
            },
            "downloads": -1,
            "filename": "Products.MIMETools-4.0.tar.gz",
            "has_sig": true,
            "md5_digest": "89280af9b43353d67f7e267a7feb7f18",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 11637,
            "upload_time": "2023-02-01T08:58:14",
            "upload_time_iso_8601": "2023-02-01T08:58:14.692229Z",
            "url": "https://files.pythonhosted.org/packages/1f/08/e7131c6a5a4f7991ad863f685475639eddc0fd18036485bb2bbbc6f7d013/Products.MIMETools-4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-01 08:58:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "zopefoundation",
    "github_project": "Products.MIMETools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "products.mimetools"
}
        
Elapsed time: 0.04458s