add zope.sendmail patch (bug fix)
This commit is contained in:
parent
eddb58c794
commit
72d7fdd05f
2 changed files with 18 additions and 3 deletions
|
@ -195,9 +195,7 @@ class SendEmail(FormController):
|
|||
# TODO: remove duplicates
|
||||
person = getPersonForUser(self.context, self.request)
|
||||
sender = person and adapted(person).email or 'loops@unknown.com'
|
||||
#msg = MIMEText(message.encode('utf-8'), 'plain', 'utf-8')
|
||||
msg = MIMEText(message, 'plain', 'utf-8')
|
||||
#msg['Subject'] = subject.encode('utf-8')
|
||||
msg['Subject'] = subject
|
||||
msg['From'] = sender
|
||||
recipients = [r.strip() for r in recipients if r.strip()]
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
import zope.index.text.widcode
|
||||
from zope.index.text.widcode import _prog, _decode, _decoding
|
||||
|
||||
def patched_decode(code):
|
||||
"""_prog pattern is now a string, but after updating from Python2
|
||||
code is still a bytes array."""
|
||||
|
@ -17,3 +16,21 @@ def patched_decode(code):
|
|||
|
||||
zope.index.text.widcode.decode = patched_decode
|
||||
print("loops.patch: monkey patch for 'zope.index.text.widcode.decode()' installed.")
|
||||
|
||||
from zope.sendmail.interfaces import IMailer
|
||||
from zope.sendmail.mailer import SMTPMailer
|
||||
def patched_smtpMailer(_context, name, hostname="localhost", port="25",
|
||||
username=None, password=None, implicit_tls=False):
|
||||
_context.action(
|
||||
discriminator=('utility', IMailer, name),
|
||||
callable=handler,
|
||||
args=('registerUtility',
|
||||
# fix error: set 'implicit_tls' as a keyword parameter
|
||||
SMTPMailer(hostname, port, username, password,
|
||||
implicit_tls=implicit_tls),
|
||||
IMailer, name)
|
||||
)
|
||||
import zope.sendmail.zcml
|
||||
zope.sendmail.zcml.smtpMailer = patched_smtpMailer
|
||||
print("loops patch: monkey patch for 'zope.sendmail.zcml.smtpMailer()' installed")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue