diff --git a/.travis.yml b/.travis.yml index 849a515..794db5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,31 +3,31 @@ language: python sudo: false matrix: - include: - - python: 2.7 - env: TOXENV=py27 - - python: 3.3 - env: TOXENV=py34 - - python: 3.4 - env: TOXENV=py34 - - python: 3.5 - env: TOXENV=py35 - - python: pypy - env: TOXENV=pypy - - python: 3.5 - env: TOXENV=py2-cover,py3-cover,coverage - - python: 3.5 - env: TOXENV=docs - - python: 2.7 - env: TOXENV=py27-pyramid12 - - python: 2.7 - env: TOXENV=py27-pyramid13 - - python: 2.7 - env: TOXENV=py27-pyramid14 - - python: 2.7 - env: TOXENV=py27-pyramid15 - - python: 2.7 - env: TOXENV=py27-pyramid16 + include: + - python: 2.7 + env: TOXENV=py27 + - python: 3.4 + env: TOXENV=py34 + - python: 3.5 + env: TOXENV=py35 + - python: 3.6 + env: TOXENV=py36 + - python: 3.7 + env: TOXENV=py37 + dist: xenial + sudo: true + - python: 3.8-dev + env: TOXENV=py38 + dist: xenial + sudo: true + - python: pypy + env: TOXENV=pypy + - python: 3.5 + env: TOXENV=py2-cover,py3-cover,coverage + - python: 3.5 + env: TOXENV=docs + allow_failures: + - env: TOXENV=py38 install: - travis_retry pip install tox @@ -38,3 +38,6 @@ script: notifications: email: - pyramid-checkins@lists.repoze.org + irc: + channels: + - "chat.freenode.net#pyramid" diff --git a/CHANGES.rst b/CHANGES.rst index 6e9a6eb..3580176 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,37 +1,63 @@ -Changelog -========= +Change History +============== + +.. _vunreleased: + +unreleased +---------- + +- Bring repo up to Pylons Project standards. + See https://github.com/Pylons/pyramid_mailer/pull/89 + +- Optionally include bcc information on send. + See https://github.com/Pylons/pyramid_mailer/pull/87 + +.. _v0.15.1: 0.15.1 (2016-12-13) ------------------- -- Pull #83: Add the new ``.bind`` method to the ``DebugMailer`` and the +- Add the new ``.bind`` method to the ``DebugMailer`` and the ``DummyMailer``. Also ``pyramid_mailer.testing`` and ``pyramid_mailer.debug`` now add the ``request.mailer`` request attribute. + https://github.com/Pylons/pyramid_mailer/pull/83 + + +.. _v0.15: 0.15 (2016-12-06) ----------------- -- Pull #49: Support '7bit' and '8bit' transfer-encoding. +- Support '7bit' and '8bit' transfer-encoding. + https://github.com/Pylons/pyramid_mailer/pull/49 -- Pull #70: If ``username`` and ``password`` are both set to the empty string, +- If ``username`` and ``password`` are both set to the empty string, ``Mailer.from_settings``, now interprets them as being set to ``None``. Previously, setting them to the empty string caused SMTP authentication to be force with empty username and password. + https://github.com/Pylons/pyramid_mailer/pull/70 -- Pull #71: Add a ``content_id`` argument to the ``Attachment`` constructor +- Add a ``content_id`` argument to the ``Attachment`` constructor which allows you to set the Content-ID header so you can reference it from an HTML body. + https://github.com/Pylons/pyramid_mailer/pull/71 -- Pull #72: Change file extension to ``.eml`` for mails saved from +- Change file extension to ``.eml`` for mails saved from ``DebugMailer``. ``.eml`` is the standard file format for storing plaintext MIME (rfc822) emails. + https://github.com/Pylons/pyramid_mailer/pull/72 -- Pull #77: Drop Python 2.6 and 3.2 support. +- Drop Python 2.6 and 3.2 support. + https://github.com/Pylons/pyramid_mailer/pull/77 - Add Python 3.5 support. -- Pull #78: Support per-request transaction managers if available via +- Support per-request transaction managers if available via ``request.tm`` set by ``pyramid_tm``. + https://github.com/Pylons/pyramid_mailer/pull/78 + + +.. _v0.14.1: 0.14.1 (2015-05-21) ------------------- @@ -44,32 +70,46 @@ Changelog to int comparisons are valid there but it was a latent bug. See https://github.com/Pylons/pyramid_mailer/pull/68 + +.. _v0.14: + 0.14 (2014-12-10) ----------------- - Added support for Python3.4, PyPy3. -- Pull #56: Ensure that ``DebugMailer`` emulates ``Mailer`` by generating +- Ensure that ``DebugMailer`` emulates ``Mailer`` by generating a sender if none is passed. + https://github.com/Pylons/pyramid_mailer/pull/56 -- Pull #52: Add configuration options for ``mail.sendmail_app`` and +- Add configuration options for ``mail.sendmail_app`` and ``mail.sendmail_template`` to allow use with non-default sendmail configurations. + https://github.com/Pylons/pyramid_mailer/pull/52 -- Pull #50: Add ``pyramid_mailer.debug`` shorthand: via one line in +- Add ``pyramid_mailer.debug`` shorthand: via one line in ``development.ini``, enables writing emails to a file instead of sending them. + https://github.com/Pylons/pyramid_mailer/pull/50 + + +.. _v0.13: 0.13 (2013-07-13) ----------------- -- Pull #45: Default transfer encoding for mail messages is now +- Default transfer encoding for mail messages is now 'quoted-printable'. + https://github.com/Pylons/pyramid_mailer/pull/45 + + +.. _v0.12: 0.12 (2013-06-26) ----------------- -- Pull #35: aadded support for sendmail binary via repoze.sendmail >= 4.0b2. +- Added support for sendmail binary via repoze.sendmail >= 4.0b2. + https://github.com/Pylons/pyramid_mailer/pull/35 - Remove "all_parts" and "attach_all_parts" from MailResponse object (unused by pyramid_mailer). @@ -84,20 +124,29 @@ Changelog - Requires repoze.sendmail >= 4.1 + +.. _v0.11: + 0.11 (2013-03-28) ----------------- -- Issue #29: Allow setting Content-Transfer-Encoding for body and html +- Allow setting Content-Transfer-Encoding for body and html via Attachments. + https://github.com/Pylons/pyramid_mailer/issues/29 -- Issue #32: Fix handling of messages with both HTML and plain text +- Fix handling of messages with both HTML and plain text bodies that also have attachments. + https://github.com/Pylons/pyramid_mailer/issues/32 -- Issue #24: ensure that ``pyramid_mailer.response.to_message`` returns +- ensure that ``pyramid_mailer.response.to_message`` returns text under Python 3.x. + https://github.com/Pylons/pyramid_mailer/issues/24 - Dropped support for Python 2.5. + +.. _v0.10: + 0.10 (2012-11-22) ----------------- @@ -112,6 +161,9 @@ Changelog - Use ``setup.py dev`` in tox.ini. + +.. _v0.9: + 0.9 (2012-05-03) ---------------- @@ -120,6 +172,9 @@ Changelog - Depend on ``repoze.sendmail`` >= 3.2 (fixes unicode multipart message encoding). + +.. _v0.8: + 0.8 (2012-03-26) ---------------- @@ -128,13 +183,19 @@ Changelog (no recipient= required anymore). See https://github.com/Pylons/pyramid_mailer/issues/14. + +.. _v0.7: + 0.7 (2012-03-26) ---------------- - Packaging release -0.6 (2012-03-20) ----------------- + +.. _v0.7dev: + +0.7dev (2012-03-20) +------------------- - Python 2.5, 2.6, 2.7, 3.2, and pypy compatibility. @@ -146,6 +207,9 @@ Changelog - More descriptive exception raised when attempting to send cc-only or bcc-only messages. See https://github.com/Pylons/pyramid_mailer/issues/14 + +.. _v0.6: + 0.6 (2012-01-22) ---------------- @@ -158,18 +222,27 @@ Changelog - Don't include ``Bcc`` header in mail messages (breaks secrecy of BCC). See https://github.com/Pylons/pyramid_mailer/pull/10 + +.. _v0.5.1: + 0.5.1 (2011-11-13) ------------------ - Fixed a bug where the mailer was only sending email to addresses in the "TO" field. + +.. _v0.5: + 0.5 (2011-10-24) ---------------- - Drop Lamson dependency by copying Lamson's MailResponse and dependent code into ``pyramid_mailer.response``. + +.. _v0.4.x: + 0.4.X ----- diff --git a/README.rst b/README.rst index 16722e8..a3d737f 100644 --- a/README.rst +++ b/README.rst @@ -5,18 +5,18 @@ :target: https://travis-ci.org/Pylons/pyramid_mailer .. image:: https://readthedocs.org/projects/pyramid_mailer/badge/?version=latest - :target: http://docs.pylonsproject.org/projects/pyramid_mailer/en/latest/ + :target: https://docs.pylonsproject.org/projects/pyramid_mailer/en/latest/ :alt: Documentation Status pyramid_mailer is a package for sending email from your Pyramid application. -It is compatible with Python 2.7, 3.3, 3.4, and 3.5, as well as PyPy. +It is compatible with Python 2.7, 3.4, 3.5, 3.6, and 3.7 as well as PyPy. This package includes: 1. Wrapping the low-level Python ``email`` library with an easy-to-use API, which includes attachments and mulipart content. -2. Send emails immediately or to add to a maildir queue. +2. Sending emails immediately or add to a ``maildir`` queue. 3. Managing email sends inside a transaction, to prevent emails being sent if your code raises an exception. @@ -32,7 +32,7 @@ Links ----- - `documentation - `_ + `_ -- `development version +- `code repository `_ diff --git a/contributing.md b/contributing.md new file mode 100644 index 0000000..cbb6754 --- /dev/null +++ b/contributing.md @@ -0,0 +1,37 @@ +# Contributing + +All projects under the Pylons Project, including this one, follow the guidelines established at [How to Contribute](https://pylonsproject.org/community-how-to-contribute.html), [Coding Style and Standards](https://pylonsproject.org/community-coding-style-standards.html), and [Pylons Project Documentation Style Guide](https://docs.pylonsproject.org/projects/pyramid_mailer/). + +You can contribute to this project in several ways. + +* [File an Issue on GitHub](https://github.com/Pylons/pyramid_mailer/issues) +* Fork this project, create a new branch, commit your suggested change, and push to your fork on GitHub. + When ready, submit a pull request for consideration. + [GitHub Flow](https://guides.github.com/introduction/flow/index.html) describes the workflow process and why it's a good practice. + When submitting a pull request, sign [CONTRIBUTORS.txt](https://github.com/Pylons/pyramid_mailer/blob/master/CONTRIBUTORS.txt) if you have not yet done so. +* Join the [IRC channel #pyramid on irc.freenode.net](https://webchat.freenode.net/?channels=pyramid). + +## Git Branches + +Git branches and their purpose and status at the time of this writing are listed below. + +* [master](https://github.com/Pylons/pyramid_mailer/) - The branch which should always be *deployable*. The default branch on GitHub. +* For development, create a new branch. If changes on your new branch are accepted, they will be merged into the master branch and deployed. + +## Running tests and building documentation + +We use [tox](https://tox.readthedocs.io/en/latest/) to automate test running, coverage, and building documentation across all supported Python versions. + +To run everything configured in the `tox.ini` file: + + $ tox + +To run tests on Python 2 and 3, and ensure full coverage, but exclude building of docs: + + $ tox -e py2-cover,py3-cover,coverage + +To build the docs only: + + $ tox -e docs + +See the `tox.ini` file for details. diff --git a/docs/changes.rst b/docs/changes.rst new file mode 120000 index 0000000..9d60ba9 --- /dev/null +++ b/docs/changes.rst @@ -0,0 +1 @@ +../CHANGES.rst \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 9da831e..75e2954 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,48 +3,26 @@ # pyramid documentation build configuration file, created by # sphinx-quickstart on Wed Jul 16 13:18:14 2008. # -# This file is execfile()d with the current directory set to its containing dir. +# This file is execfile()d with the current directory set to its containing +# dir. # # The contents of this file are pickled, so don't put values in the namespace -# that aren't pickleable (module imports are okay, they're removed automatically). +# that aren't pickleable (module imports are okay, they're removed +# automatically). # # All configuration values have a default value; values that are commented out # serve to show the default value. -import sys, os +import datetime import pkg_resources import pylons_sphinx_themes -import datetime -import inspect -import warnings - -warnings.simplefilter('ignore', DeprecationWarning) - -# skip raw nodes -from sphinx.writers.text import TextTranslator -from sphinx.writers.latex import LaTeXTranslator - -from docutils import nodes -from docutils import utils - -def raw(*arg): - raise nodes.SkipNode -TextTranslator.visit_raw = raw - - -# make sure :app:`Pyramid` doesn't mess up LaTeX rendering -def nothing(*arg): - pass -LaTeXTranslator.visit_inline = nothing -LaTeXTranslator.depart_inline = nothing -book = os.environ.get('BOOK') # General configuration # --------------------- -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', @@ -53,12 +31,12 @@ def nothing(*arg): intersphinx_mapping = { 'pyramid': ( - 'http://docs.pylonsproject.org/projects/pyramid/en/latest/', + 'https://docs.pylonsproject.org/projects/pyramid/en/latest/', None), } # Add any paths that contain templates here, relative to this directory. -#templates_path = ['_templates'] +# templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' @@ -68,7 +46,8 @@ def nothing(*arg): # General substitutions. project = 'Pyramid mailer library' -copyright = '%s, Dan Jacob' % datetime.datetime.now().year +thisyear = datetime.datetime.now().year +copyright = '2010 - %s, Dan Jacob' % thisyear # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. @@ -80,25 +59,26 @@ def nothing(*arg): # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. -#unused_docs = [] +# unused_docs = [] -# List of directories, relative to source directories, that shouldn't be searched -# for source files. -#exclude_dirs = [] +# List of directories, relative to source directories, that shouldn't be +# searched for source files. +# exclude_dirs = [] # directories to ignore when looking for source files. -exclude_patterns = ['_themes/README.rst',] +# exclude_patterns = ['_themes/README.rst', ] -# The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# The reST default role (used for this markup: `text`) to use for all +# documents. +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). @@ -106,15 +86,11 @@ def nothing(*arg): # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -#pygments_style = book and 'bw' or 'tango' -if book: - pygments_style = 'bw' +pygments_style = 'sphinx' -# The default language to highlight source code in. -#highlight_language = 'guess' # Options for HTML output # ----------------------- @@ -122,71 +98,76 @@ def nothing(*arg): # Add and use Pylons theme html_theme_path = pylons_sphinx_themes.get_html_themes_path() html_theme = 'pyramid' -html_theme_options = dict(github_url='http://github.com/Pylons/pyramid_mailer') +html_theme_options = dict( + github_url='https://github.com/Pylons/pyramid_mailer') # The style sheet to use for HTML and HTML Help pages. A file of that name # must exist either in Sphinx' static/ path, or in one of the custom paths # given in html_static_path. -#html_style = 'pyramid.css' +# html_style = 'pyramid.css' # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". html_title = 'pyramid_mailer v%s' % release # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = 'Home' +# html_short_title = 'Home' # The name of an image file (within the static path) to place at the top of # the sidebar. -#html_logo = '_static/pyramid.png' +# html_logo = '_static/pyramid.png' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = '_static/pyramid.ico' +# html_favicon = '_static/pyramid.ico' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = ['_static'] +# html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%b %d, %Y' -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# Control display of sidebars and include ethical ads from RTD +html_sidebars = {'**': [ + 'localtoc.html', + 'ethicalads.html', + 'relations.html', + 'sourcelink.html', + 'searchbox.html', +]} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_use_modindex = True +# html_use_modindex = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, the reST sources are included in the HTML build as _sources/. -#html_copy_source = True +# html_copy_source = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = '' +# html_file_suffix = '' # Output file base name for HTML help builder. -htmlhelp_basename = 'pyramid' +htmlhelp_basename = 'pyramid_mailer' + # Options for LaTeX output # ------------------------ @@ -198,247 +179,40 @@ def nothing(*arg): latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, document class [howto/manual]). +# (source start file, target name, title, author, +# document class [howto/manual]). latex_documents = [ - ('latexindex', 'pyramid.tex', - 'The Pyramid Web Application Development Framework', - 'Chris McDonough', 'manual'), + ('latexindex', 'pyramid_mailer.tex', + 'pyramid_mailer', + 'Dan Jacob', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = '_static/pylons_small.png' +# latex_logo = '_static/pylons_small.png' # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -latex_use_parts = True +# latex_use_parts = True # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -latex_use_modindex = False - -## Say, for a moment that you have a twoside document that needs a 3cm -## inner margin to allow for binding and at least two centimetres the -## rest of the way around. You've been using the a4wide package up until -## now, because you like the amount of text it places on the -## page. Perhaps try something like this in your preamble: - -## \usepackage[bindingoffset=1cm,textheight=22cm,hdivide={2cm,*,2cm},vdivide={*,22cm,*}]{geometry} - -## _PREAMBLE = r"""\usepackage[bindingoffset=0.45in,textheight=7.25in,hdivide={0.5in,*,0.75in},vdivide={1in,7.25in,1in},papersize={7.5in,9.25in}]{geometry}""" - -_PREAMBLE = r""" -\usepackage[]{geometry} -\geometry{bindingoffset=0.45in,textheight=7.25in,hdivide={0.5in,*,0.75in},vdivide={1in,7.25in,1in},papersize={7.5in,9.25in}} -\hypersetup{ - colorlinks=true, - linkcolor=black, - citecolor=black, - filecolor=black, - urlcolor=black -} -\fvset{frame=single,xleftmargin=9pt,numbersep=4pt} - -\pagestyle{fancy} - -% header and footer styles -\renewcommand{\chaptermark}[1]% - {\markboth{\MakeUppercase{\thechapter.\ #1}}{} - } -\renewcommand{\sectionmark}[1]% - {\markright{\MakeUppercase{\thesection.\ #1}} - } - -% defaults for fancy style -\renewcommand{\headrulewidth}{0pt} -\renewcommand{\footrulewidth}{0pt} -\fancyhf{} -\fancyfoot[C]{\thepage} - -% plain style -\fancypagestyle{plain}{ - \renewcommand{\headrulewidth}{0pt} % ho header line - \renewcommand{\footrulewidth}{0pt}% no footer line - \fancyhf{} % empty header and footer - \fancyfoot[C]{\thepage} -} +# latex_use_modindex = False -% title page styles -\makeatletter -\def\@subtitle{\relax} -\newcommand{\subtitle}[1]{\gdef\@subtitle{#1}} -\renewcommand{\maketitle}{ - \begin{titlepage} - {\rm\Huge\@title\par} - {\em\large\py@release\releaseinfo\par} - \if\@subtitle\relax\else\large\@subtitle\par\fi - {\large\@author\par} - \end{titlepage} -} -\makeatother - -% Redefine link and title colors -\definecolor{TitleColor}{rgb}{0,0,0} -\definecolor{InnerLinkColor}{rgb}{0.208,0.374,0.486} -\definecolor{OuterLinkColor}{rgb}{0.216,0.439,0.388} -% Redefine these colors to something not white if you want to have colored -% background and border for code examples. -\definecolor{VerbatimColor}{rgb}{1,1,1} -\definecolor{VerbatimBorderColor}{rgb}{1,1,1} - -\makeatletter -\renewcommand{\py@noticestart@warning}{\py@heavybox} -\renewcommand{\py@noticeend@warning}{\py@endheavybox} -\renewcommand{\py@noticestart@note}{\py@heavybox} -\renewcommand{\py@noticeend@note}{\py@endheavybox} -\makeatother - -% icons in note and warning boxes -\usepackage{ifthen} -% Keep a copy of the original notice environment -\let\origbeginnotice\notice -\let\origendnotice\endnotice - -% Redefine the notice environment so we can add our own code to it -\renewenvironment{notice}[2]{% - \origbeginnotice{#1}{}% equivalent to original \begin{notice}{#1}{#2} - % load graphics - \ifthenelse{\equal{#1}{warning}}{\includegraphics{latex-warning.png}}{} - \ifthenelse{\equal{#1}{note}}{\includegraphics{latex-note.png}}{} - % etc. -}{% - \origendnotice% equivalent to original \end{notice} -} - -% try to prevent code-block boxes from splitting across pages -\sloppy -\widowpenalty=300 -\clubpenalty=300 -\setlength{\parskip}{3ex plus 2ex minus 2ex} - -% suppress page numbers on pages showing part title -\makeatletter -\let\sv@endpart\@endpart -\def\@endpart{\thispagestyle{empty}\sv@endpart} -\makeatother - -% prevent page numbers in TOC (reset to fancy by frontmatter directive) -\pagestyle{empty} -""" - -latex_elements = { - 'preamble': _PREAMBLE, - 'wrapperclass':'book', - 'date':'', - 'releasename':'Version', - 'title':r'pyramid_mailer', -# 'pointsize':'12pt', # uncomment for 12pt version -} +# Do not use smart quotes. +smartquotes = False -# secnumdepth counter reset to 2 causes numbering in related matter; -# reset to -1 causes chapters to not be numbered, reset to -2 causes -# parts to not be numbered. - -#part -1 -#chapter 0 -#section 1 -#subsection 2 -#subsubsection 3 -#paragraph 4 -#subparagraph 5 - -def frontmatter(name, arguments, options, content, lineno, - content_offset, block_text, state, state_machine): - return [nodes.raw( - '', - r""" -\frontmatter -% prevent part/chapter/section numbering -\setcounter{secnumdepth}{-2} -% suppress headers -\pagestyle{plain} -% reset page counter -\setcounter{page}{1} -% suppress first toc pagenum -\addtocontents{toc}{\protect\thispagestyle{empty}} -""", - format='latex')] - -def mainmatter(name, arguments, options, content, lineno, - content_offset, block_text, state, state_machine): - return [nodes.raw( - '', - r""" -\mainmatter -% allow part/chapter/section numbering -\setcounter{secnumdepth}{2} -% get headers back -\pagestyle{fancy} -\fancyhf{} -\renewcommand{\headrulewidth}{0.5pt} -\renewcommand{\footrulewidth}{0pt} -\fancyfoot[C]{\thepage} -\fancyhead[RO]{\rightmark} -\fancyhead[LE]{\leftmark} -""", - format='latex')] - -def backmatter(name, arguments, options, content, lineno, - content_offset, block_text, state, state_machine): - return [nodes.raw('', '\\backmatter\n\\setcounter{secnumdepth}{-1}\n', - format='latex')] - -def app_role(role, rawtext, text, lineno, inliner, options={}, content=[]): - """custom role for :app: marker, does nothing in particular except allow - :app:`Pyramid` to work (for later search and replace).""" - if 'class' in options: - assert 'classes' not in options - options['classes'] = options['class'] - del options['class'] - return [nodes.inline(rawtext, utils.unescape(text), **options)], [] - - -def setup(app): - app.add_role('app', app_role) - app.add_directive('frontmatter', frontmatter, 1, (0, 0, 0)) - app.add_directive('mainmatter', mainmatter, 1, (0, 0, 0)) - app.add_directive('backmatter', backmatter, 1, (0, 0, 0)) - app.connect('autodoc-process-signature', resig) - -def resig(app, what, name, obj, options, signature, return_annotation): - """ Allow for preservation of ``@action_method`` decorated methods - in configurator """ - docobj = getattr(obj, '__docobj__', None) - if docobj is not None: - argspec = inspect.getargspec(docobj) - if argspec[0] and argspec[0][0] in ('cls', 'self'): - del argspec[0][0] - signature = inspect.formatargspec(*argspec) - return signature, return_annotation - -# turn off all line numbers in latex formatting - -## from pygments.formatters import LatexFormatter -## from sphinx.highlighting import PygmentsBridge - -## class NoLinenosLatexFormatter(LatexFormatter): -## def __init__(self, **options): -## LatexFormatter.__init__(self, **options) -## self.linenos = False - -## PygmentsBridge.latex_formatter = NoLinenosLatexFormatter - -# -- Options for Epub output --------------------------------------------------- +# -- Options for Epub output -------------------------------------------------- # Bibliographic Dublin Core info. epub_title = 'pyramid_mailer' epub_author = 'Dan Jacob' -epub_copyright = '2010-2011' +epub_copyright = '2010 - %s, Dan Jacob' % thisyear # The language of the text. It defaults to the language option # or en if the language is not set. @@ -455,14 +229,14 @@ def resig(app, what, name, obj, options, signature, return_annotation): # HTML files that should be inserted before the pages created by sphinx. # The format is a list of tuples containing the path and title. -#epub_pre_files = [] +# epub_pre_files = [] # HTML files shat should be inserted after the pages created by sphinx. # The format is a list of tuples containing the path and title. -#epub_post_files = [] +# epub_post_files = [] # A list of files that should not be packed into the epub file. -#epub_exclude_files = [] +# epub_exclude_files = [] # The depth of the table of contents in toc.ncx. epub_tocdepth = 3 diff --git a/docs/index.rst b/docs/index.rst index a1ced01..5c04332 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,9 +1,11 @@ +.. _index: + pyramid_mailer -================== +============== -**pyramid_mailer** is a package for the `Pyramid`_ framework to take the pain -out of sending emails. It is compatible with Python 2.7, 3.3, and 3.4, as well -as PyPy. It has the following features: +**pyramid_mailer** is a package for the `Pyramid`_ framework to take the pain out of sending emails. +It is compatible with Python 2.7, 3.4, 3.5, 3.6, and 3.7 as well as PyPy. +It has the following features: 1. A wrapper around the low-level email functionality of standard Python. This includes handling multipart emails with both text and HTML @@ -254,7 +256,7 @@ For example:: The email is not actually sent until the transaction is committed. -When the `repoze.tm2 `_ ``tm`` +When the `repoze.tm2 `_ ``tm`` middleware is in your Pyramid WSGI pipeline or if you've included the ``pyramid_tm`` package in your Pyramid configuration, transactions are already managed for you, so you don't need to explicitly commit or abort @@ -263,11 +265,11 @@ transaction will implicitly be aborted and mail will not be sent; otherwise it will be committed, and mail will be sent. HTML email --------------------- +---------- Below is a recipe how to send templatized HTML and plain text email. The email is assembled from three templates: subject, HTML body and text -body. It is also recommend to use `premailer `_ +body. It is also recommend to use `premailer `_ Python package to transform email CSS styles to inline CSS, as email clients are pretty restricted what comes to their ability to understand CSS. @@ -345,7 +347,6 @@ class:: You can pass the data either as a string or file object, so the above code could be rewritten:: - from pyramid_mailer.message import Attachment from pyramid_mailer.message import Message @@ -525,13 +526,22 @@ API .. autoclass:: BadHeaders :members: + +Change History +-------------- + +.. toctree:: + :maxdepth: 2 + + changes + + .. _Github: https://github.com/Pylons/pyramid_mailer -.. _Pyramid: http://pypi.python.org/pypi/pyramid/ +.. _Pyramid: https://pypi.org/project/pyramid/ .. _Ubuntu's Postfix guide: https://help.ubuntu.com/lts/serverguide/postfix.html .. _ArchLinux Postfix guide: https://wiki.archlinux.org/index.php/postfix -.. _OSX Postfix instructions: http://benjaminrojas.net/configuring-postfix-to- - send-mail-from-mac-os-x-mountain-lion +.. _OSX Postfix instructions: https://benjaminrojas.net/configuring-postfix-to-send-mail-from-mac-os-x-mountain-lion/ .. _setup an SMTP with IIS: http://www.neatcomponents.com/enable-SMTP-in-Windows-8 -.. _repoze_sendmail: http://pypi.python.org/pypi/repoze.sendmail/ -.. _Lamson: http://pypi.python.org/pypi/lamson/ -.. _WebTest: http://pypi.python.org/pypi/WebTest/ +.. _repoze_sendmail: https://pypi.org/project/repoze.sendmail/ +.. _Lamson: https://pypi.org/project/lamson/ +.. _WebTest: https://pypi.org/project/WebTest/ diff --git a/setup.py b/setup.py index 11fe59c..71132ba 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,10 @@ from setuptools import setup docs_extras = [ - 'Sphinx', + 'Sphinx >= 1.8.1', 'docutils', 'repoze.sphinx.autointerface', - 'pylons-sphinx-themes >= 0.3', + 'pylons-sphinx-themes >= 1.0.10', ] tests_require = [] @@ -34,7 +34,7 @@ author_email='danjac354@gmail.com', description='Sendmail package for Pyramid', long_description='\n\n'.join([README, CHANGES]), - url="http://docs.pylonsproject.org/projects/pyramid-mailer/en/latest/", + url="https://docs.pylonsproject.org/projects/pyramid-mailer/en/latest/", packages=[ 'pyramid_mailer', ], @@ -59,8 +59,10 @@ "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Framework :: Pyramid", diff --git a/tox.ini b/tox.ini index 27cc5d1..4ab1e52 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = - py27,py33,py34,py35,pypy, - py27-pyramid{12,13,14,15,16}, + py27,py34,py35,py36,py37,pypy, + py27-pyramid{12,13,14,15,16,17,18,19}, docs, {py2,py3}-cover,coverage @@ -10,9 +10,11 @@ envlist = # to defaults for others. basepython = py27: python2.7 - py33: python3.3 py34: python3.4 py35: python3.5 + py36: python3.6 + py37: python3.7 + py38: python3.8 pypy: pypy pypy3: pypy3 py2: python2.7 @@ -24,6 +26,9 @@ deps = pyramid14: pyramid <= 1.4.99 pyramid15: pyramid <= 1.5.99 pyramid16: pyramid <= 1.6.99 + pyramid17: pyramid <= 1.7.99 + pyramid18: pyramid <= 1.8.99 + pyramid19: pyramid <= 1.9.99 commands = pip install -q pyramid_mailer[testing]