Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(774)

Issue 13274046: Fix EmailHandler to not fall into infinite recursion (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 8 months ago by ana.balica
Modified:
10 years, 3 months ago
Reviewers:
thomas.j.waldmann
Visibility:
Public.

Description

Detect indirect recursion caused by sendmail, which raises exceptions. Lines 185, 189, 213 refer to Unicode literals for email subject cr - https://codereview.appspot.com/13629046/

Patch Set 1 #

Total comments: 5

Patch Set 2 : Fixes #

Patch Set 3 : Discard global variable #

Total comments: 3

Patch Set 4 : Use instance variable for the EmailHandler #

Patch Set 5 : Use try/finally #

Total comments: 1

Patch Set 6 : Wrap main code from emit method into try #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -12 lines) Patch
M MoinMoin/log.py View 1 2 3 4 5 3 chunks +13 lines, -12 lines 1 comment Download

Messages

Total messages: 8
Thomas.J.Waldmann
https://codereview.appspot.com/13274046/diff/1/MoinMoin/log.py File MoinMoin/log.py (right): https://codereview.appspot.com/13274046/diff/1/MoinMoin/log.py#newcode202 MoinMoin/log.py:202: global in_email_handler globals are usually a recipe for problems. ...
10 years, 8 months ago (2013-09-21 00:52:40 UTC) #1
ana.balica
https://codereview.appspot.com/13274046/diff/1/MoinMoin/log.py File MoinMoin/log.py (right): https://codereview.appspot.com/13274046/diff/1/MoinMoin/log.py#newcode202 MoinMoin/log.py:202: global in_email_handler On 2013/09/21 00:52:40, Thomas.J.Waldmann wrote: > globals ...
10 years, 8 months ago (2013-09-22 21:17:18 UTC) #2
Thomas.J.Waldmann
https://codereview.appspot.com/13274046/diff/1/MoinMoin/log.py File MoinMoin/log.py (right): https://codereview.appspot.com/13274046/diff/1/MoinMoin/log.py#newcode216 MoinMoin/log.py:216: if app.cfg.email_tracebacks: so, if that is False, you are ...
10 years, 8 months ago (2013-09-23 10:52:20 UTC) #3
Thomas.J.Waldmann
https://codereview.appspot.com/13274046/diff/1/MoinMoin/log.py File MoinMoin/log.py (right): https://codereview.appspot.com/13274046/diff/1/MoinMoin/log.py#newcode208 MoinMoin/log.py:208: cfg = app.cfg this line is a bit superfluous ...
10 years, 8 months ago (2013-09-23 11:00:03 UTC) #4
ana.balica
https://codereview.appspot.com/13274046/diff/1/MoinMoin/log.py File MoinMoin/log.py (right): https://codereview.appspot.com/13274046/diff/1/MoinMoin/log.py#newcode216 MoinMoin/log.py:216: if app.cfg.email_tracebacks: On 2013/09/23 10:52:20, Thomas.J.Waldmann wrote: > also, ...
10 years, 8 months ago (2013-09-23 14:16:16 UTC) #5
Thomas.J.Waldmann
https://codereview.appspot.com/13274046/diff/10001/MoinMoin/log.py File MoinMoin/log.py (right): https://codereview.appspot.com/13274046/diff/10001/MoinMoin/log.py#newcode195 MoinMoin/log.py:195: self.in_email_handler = True why did you change the initial ...
10 years, 6 months ago (2013-10-25 13:20:21 UTC) #6
Thomas.J.Waldmann
https://codereview.appspot.com/13274046/diff/50001/MoinMoin/log.py File MoinMoin/log.py (right): https://codereview.appspot.com/13274046/diff/50001/MoinMoin/log.py#newcode210 MoinMoin/log.py:210: self.in_email_handler = True with try/finally, you are making sure ...
10 years, 6 months ago (2013-11-18 14:55:41 UTC) #7
Thomas.J.Waldmann
10 years, 6 months ago (2013-11-18 15:06:47 UTC) #8
https://codereview.appspot.com/13274046/diff/70001/MoinMoin/log.py
File MoinMoin/log.py (right):

https://codereview.appspot.com/13274046/diff/70001/MoinMoin/log.py#newcode211
MoinMoin/log.py:211: self.in_email_handler = True
well, almost :)

it doesn't make a real difference in this case, but just so you know the general
pattern:

DO_X
try:
    ...
finally:
    UNDO_X

(there is no point in undoing an it some cases it might even fail trying to do
so in case it blows up in the "do" operation itself)

to support such stuff even better, python has so-called context managers, see
the "with" statement, that make such stuff easier. not needed here, though.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b