Skip to content

Commit

Permalink
- Drop Lamson dependency by copying Lamson's MailResponse and depende…
Browse files Browse the repository at this point in the history
…nt code

  into ``pyramid_mailer.response``.
  • Loading branch information
mcdonc committed Aug 12, 2011
1 parent d81998c commit 623d50f
Show file tree
Hide file tree
Showing 9 changed files with 883 additions and 59 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Next release
------------

- Drop Lamson dependency by copying Lamson's MailResponse and dependent code
into ``pyramid_mailer.response``.

0.4.X
-----

- ``pyramid_mailer.includeme`` function added for
``config.include('pyramid_mailer')`` support

Expand Down
95 changes: 64 additions & 31 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,64 @@
Copyright (c) 2010 by Dan Jacob.

Some rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
All code except "response.py":

Copyright (c) 2010 by Dan Jacob.
Some rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

"response.py":

Copyright (c) 2011 Zed Shaw
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the Zed A. Shaw nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
4 changes: 4 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
pyramid_mailer is a package for sending email from your Pyramid application.

See the documentation at
https://docs.pylonsproject.org/projects/pyramid_mailer/dev/ for more info.

pyramid_mailer uses code from the Lamson Project (http://lamsonproject.org/)
with permission. See the LICENSE.txt file for more information.
29 changes: 9 additions & 20 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ maildir.
non-production install.

**pyramid_mailer** uses the `repoze_sendmail`_ package for general email
sending, queuing and transaction management, and the `Lamson`_ library for
low-level multipart message encoding and wrapping. You do not have to install
or run a Lamson mail service.
sending, queuing and transaction management, and it borrows code from Zed
Shaw's `Lamson`_ library for low-level multipart message encoding and
wrapping.

Installation
------------
Expand All @@ -37,18 +37,6 @@ setup.py install**.
The source repository is on `Bitbucket`_. Please report any bugs, issues or
queries there.

Installing on Windows
---------------------

Some Windows users have reported issues installing `Lamson`_ due to some
dependencies that do not work on Windows.

The best way to install on Windows is to install the individual packages
using the `no dependencies` option::

easy_install -N lamson chardet repoze.sendmail pyramid_mailer


Getting Started (The Easier Way)
--------------------------------

Expand Down Expand Up @@ -218,11 +206,12 @@ For example::
The email is not actually sent until the transaction is committed.

When the `repoze.tm2 <http://pypi.python.org/pypi/repoze.tm2>`_ ``tm``
middleware is in your Pyramid WSGI pipeline, transactions are already managed
for you, so you don't need to explicitly commit or abort within code that
sends mail. Instead, if an exception is raised, the transaction will
implicitly be aborted and mail will not be sent; otherwise it will be
committed, and mail will be sent.
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
within code that sends mail. Instead, if an exception is raised, the
transaction will implicitly be aborted and mail will not be sent; otherwise
it will be committed, and mail will be sent.

Attachments
-----------
Expand Down
4 changes: 2 additions & 2 deletions pyramid_mailer/mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def smtp_factory(self):
keyfile=self.keyfile,
certfile=self.certfile)

connection.set_debuglevel(self.debug_smtp)
connection.set_debuglevel(self.debug_smtp) # pragma: no cover
return connection # pragma: no cover


Expand Down Expand Up @@ -194,7 +194,7 @@ def send_immediately(self, message, fail_silently=False):

try:
return self.smtp_mailer.send(*self._message_args(message))
except smtplib.socket.error, e:
except smtplib.socket.error:
if not fail_silently:
raise

Expand Down
2 changes: 1 addition & 1 deletion pyramid_mailer/message.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from lamson.mail import MailResponse
from pyramid_mailer.response import MailResponse

from pyramid_mailer.exceptions import BadHeaders
from pyramid_mailer.exceptions import InvalidMessage
Expand Down
Loading

0 comments on commit 623d50f

Please sign in to comment.