Mercurial > p > roundup > code
comparison roundup/mailer.py @ 5248:198b6e810c67
Use Python-3-compatible 'as' syntax for except statements
Many raise statements near these are also fixed.
So are two ivorrect file encoding marks ('utf8'->'utf-8').
| author | Eric S. Raymond <esr@thyrsus.com> |
|---|---|
| date | Thu, 24 Aug 2017 22:21:37 -0400 |
| parents | 092c4522b3bf |
| children | 17edccfe1755 |
comparison
equal
deleted
inserted
replaced
| 5247:7f00a47b3559 | 5248:198b6e810c67 |
|---|---|
| 187 body = [] | 187 body = [] |
| 188 for header in bounced_message.headers: | 188 for header in bounced_message.headers: |
| 189 body.append(header) | 189 body.append(header) |
| 190 try: | 190 try: |
| 191 bounced_message.rewindbody() | 191 bounced_message.rewindbody() |
| 192 except IOError, errmessage: | 192 except IOError as errmessage: |
| 193 body.append("*** couldn't include message body: %s ***" % | 193 body.append("*** couldn't include message body: %s ***" % |
| 194 errmessage) | 194 errmessage) |
| 195 else: | 195 else: |
| 196 body.append('\n') | 196 body.append('\n') |
| 197 body.append(bounced_message.fp.read()) | 197 body.append(bounced_message.fp.read()) |
| 290 try: | 290 try: |
| 291 # send the message as admin so bounces are sent there | 291 # send the message as admin so bounces are sent there |
| 292 # instead of to roundup | 292 # instead of to roundup |
| 293 smtp = SMTPConnection(self.config) | 293 smtp = SMTPConnection(self.config) |
| 294 smtp.sendmail(sender, to, message) | 294 smtp.sendmail(sender, to, message) |
| 295 except socket.error, value: | 295 except socket.error as value: |
| 296 raise MessageSendError("Error: couldn't send email: " | 296 raise MessageSendError("Error: couldn't send email: " |
| 297 "mailhost %s"%value) | 297 "mailhost %s"%value) |
| 298 except smtplib.SMTPException, msg: | 298 except smtplib.SMTPException, msg: |
| 299 raise MessageSendError("Error: couldn't send email: %s"%msg) | 299 raise MessageSendError("Error: couldn't send email: %s"%msg) |
| 300 | 300 |
