py-flask-sendmail: improve and import a couple fixes
The updated patches: - fix the suppressing of messages when testing or disabled in configuration; - import what should be a better fix when piping messages to sendmail(1). Bumps PKGREVISION.
This commit is contained in:
parent
e3a24f5a7d
commit
aacb348fe6
5 changed files with 40 additions and 12 deletions
|
@ -1,7 +1,8 @@
|
|||
# $NetBSD: Makefile,v 1.1 2021/05/27 22:25:05 khorben Exp $
|
||||
# $NetBSD: Makefile,v 1.2 2021/06/02 21:06:03 khorben Exp $
|
||||
|
||||
DISTNAME= Flask-Sendmail-0.1
|
||||
PKGNAME= ${PYPKGPREFIX}-${DISTNAME:tl}
|
||||
PKGREVISION= 1
|
||||
CATEGORIES= www python
|
||||
MASTER_SITES= ${MASTER_SITE_PYPI:=F/Flask-Sendmail/}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@comment $NetBSD: PLIST,v 1.1 2021/05/27 22:25:05 khorben Exp $
|
||||
@comment $NetBSD: PLIST,v 1.2 2021/06/02 21:06:03 khorben Exp $
|
||||
${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
|
||||
${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
|
||||
${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
$NetBSD: distinfo,v 1.1 2021/05/27 22:25:05 khorben Exp $
|
||||
$NetBSD: distinfo,v 1.2 2021/06/02 21:06:03 khorben Exp $
|
||||
|
||||
SHA1 (Flask-Sendmail-0.1.tar.gz) = 6ac44c275a3d9dce4ed3d028335537ed19e67cef
|
||||
RMD160 (Flask-Sendmail-0.1.tar.gz) = 7b79b89250b9376ff5f9f2f1d1b3b0508c861a6a
|
||||
SHA512 (Flask-Sendmail-0.1.tar.gz) = c341d841a5ea2ff06d60361bf323fd3d9bce1b332143da415534e9176d797fbd5bd59ea9b7563a81e35dbe93dcbb6d957f02df61bd191b385eb834638133aecd
|
||||
Size (Flask-Sendmail-0.1.tar.gz) = 3410 bytes
|
||||
SHA1 (patch-flask__sendmail_connection.py) = 8ec1db04739ffe9d41006c68b3670f97a39ae8cc
|
||||
SHA1 (patch-flask__sendmail_connection.py) = bcc2161f5f1d5bcaa67a67b319554e3d41ee0e97
|
||||
SHA1 (patch-flask__sendmail_message.py) = 7aa1f56237e7ae3704eb98060dded53222ed29a1
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
$NetBSD: patch-flask__sendmail_connection.py,v 1.1 2021/05/27 22:25:05 khorben Exp $
|
||||
$NetBSD: patch-flask__sendmail_connection.py,v 1.2 2021/06/02 21:06:03 khorben Exp $
|
||||
|
||||
Fix type error when sending messages
|
||||
Do not send messages when testing or disabled in configuration
|
||||
|
||||
Submitted upstream in PR #12 (at
|
||||
https://github.com/ajford/flask-sendmail/pull/12).
|
||||
|
||||
--- flask_sendmail/connection.py.orig 2012-04-23 02:11:53.000000000 +0000
|
||||
+++ flask_sendmail/connection.py
|
||||
@@ -20,7 +20,7 @@ class Connection(object):
|
||||
@@ -18,6 +18,9 @@ class Connection(object):
|
||||
pass
|
||||
|
||||
def send(self, message):
|
||||
+ if self.suppress:
|
||||
+ return 0
|
||||
+
|
||||
sm = Popen([self.mail.mailer, self.mail.mailer_flags], stdin=PIPE,
|
||||
stdout=PIPE, stderr=STDOUT)
|
||||
- sm.stdin.write(message.dump())
|
||||
+ sm.stdin.write(message.dump().encode())
|
||||
sm.communicate()
|
||||
|
||||
return sm.returncode
|
||||
sm.stdin.write(message.dump())
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
$NetBSD: patch-flask__sendmail_message.py,v 1.1 2021/06/02 21:06:03 khorben Exp $
|
||||
|
||||
Fix for Python 3
|
||||
|
||||
From commit cc55636201554d1cf8516bb5bf0326bb498d03a7 in the flask-sendmail-ng
|
||||
fork at https://github.com/ncrocfer/flask-sendmail-ng.
|
||||
|
||||
--- flask_sendmail/message.py.orig 2012-04-23 02:41:10.000000000 +0000
|
||||
+++ flask_sendmail/message.py
|
||||
@@ -99,7 +99,11 @@ class Message(object):
|
||||
if self.reply_to:
|
||||
msg['Reply-To'] = self.reply_to
|
||||
|
||||
- return msg.as_string()
|
||||
+ msg_str = msg.as_string()
|
||||
+ if sys.version_info >= (3,0) and isinstance(msg_str, str):
|
||||
+ return msg_str.encode(self.charset or 'utf-8')
|
||||
+ else:
|
||||
+ return msg_str
|
||||
|
||||
def send(self, connection):
|
||||
"""
|
Loading…
Reference in a new issue