Author: hartmannathan
Date: Tue Nov  5 16:23:47 2019
New Revision: 1869419

URL: http://svn.apache.org/viewvc?rev=1869419&view=rev
Log:
mailer.py: Fix breakage on Python 2 from use of Python 3 syntax

Follow-up on r1869194. That revision addresses issue SVN-1804 by
adding exception handling for SMTP errors. Unfortunately a last-minute
change in that revision uses Python 3+ 'raise..from' syntax. The
script does not yet support Python 3 so this breaks the script for all
Python versions!

* tools/hook-scripts/mailer/mailer.py
  (SMTPOutput.finish): Comment out the two instances of 'from detail'
    that break the script, but add a 'TODO' note to uncomment them
    when converting the script to Python 3.

Suggested by: futatuki
              danielsh

Modified:
    subversion/trunk/tools/hook-scripts/mailer/mailer.py

Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.py?rev=1869419&r1=1869418&r2=1869419&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/mailer/mailer.py (original)
+++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Tue Nov  5 16:23:47 
2019
@@ -322,15 +322,19 @@ class SMTPOutput(MailedOutput):
 
       server.sendmail(self.from_addr, self.to_addrs, self.buffer.getvalue())
 
+    ### TODO: 'raise .. from' is Python 3+. When we convert this
+    ###       script to Python 3, uncomment 'from detail' below
+    ###       (2 instances):
+
     except smtplib.SMTPRecipientsRefused as detail:
       sys.stderr.write("mailer.py: SMTP recipient(s) refused: %s: %s\n"
                            % (self.to_addrs, detail,))
-      raise MessageSendFailure from detail
+      raise MessageSendFailure ### from detail
 
     except smtplib.SMTPSenderRefused as detail:
       sys.stderr.write("mailer.py: SMTP sender refused: %s: %s\n"
                            % (self.from_addr, detail,))
-      raise MessageSendFailure from detail
+      raise MessageSendFailure ### from detail
 
     except smtplib.SMTPException as detail:
       # All other errors are fatal; this includes:


Reply via email to