Merge lp:~matsubara/launchpad/bug-553361-no-referrer into lp:launchpad

Proposed by Diogo Matsubara
Status: Merged
Approved by: Diogo Matsubara
Approved revision: no longer in the source branch.
Merged at revision: 10829
Proposed branch: lp:~matsubara/launchpad/bug-553361-no-referrer
Merge into: lp:launchpad
Diff against target: 51 lines (+21/-2)
2 files modified
lib/canonical/launchpad/webapp/errorlog.py (+1/-1)
lib/canonical/launchpad/webapp/tests/test_errorlog.py (+20/-1)
To merge this branch: bzr merge lp:~matsubara/launchpad/bug-553361-no-referrer
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) release-critical Approve
Brad Crittenden (community) code Approve
Gary Poster Pending
Review via email: mp+24506@code.launchpad.net

Commit message

[r=bac] Fix bug 553361 by not logging an OOPS report when NoReferrerError is raised.

Description of the change

Fix bug 553361 by not logging an OOPS report when NoReferrerError is raised.

= QA =
To run the tests:
$ bin/test -u test_errorlog

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

Hi Diogo,

The branch looks good. Please alphabetize the imports at line 23 of the diff.

review: Approve (code)
Revision history for this message
Francis J. Lacoste (flacoste) wrote :

Once that's QA on edge, I'd like this cherry-picked.

review: Approve (release-critical)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/webapp/errorlog.py'
2--- lib/canonical/launchpad/webapp/errorlog.py 2009-11-26 21:25:17 +0000
3+++ lib/canonical/launchpad/webapp/errorlog.py 2010-05-05 01:47:26 +0000
4@@ -231,7 +231,7 @@
5
6 _ignored_exceptions = set([
7 'ReadOnlyModeDisallowedStore', 'ReadOnlyModeViolation',
8- 'TranslationUnavailable'])
9+ 'TranslationUnavailable', 'NoReferrerError'])
10 _ignored_exceptions_for_unauthenticated_users = set(['Unauthorized'])
11 _default_config_section = 'error_reports'
12
13
14=== modified file 'lib/canonical/launchpad/webapp/tests/test_errorlog.py'
15--- lib/canonical/launchpad/webapp/tests/test_errorlog.py 2010-01-21 03:52:05 +0000
16+++ lib/canonical/launchpad/webapp/tests/test_errorlog.py 2010-05-05 01:47:26 +0000
17@@ -34,7 +34,8 @@
18 from canonical.launchpad.webapp.errorlog import (
19 ErrorReport, ErrorReportingUtility, OopsLoggingHandler, ScriptRequest,
20 _is_sensitive)
21-from canonical.launchpad.webapp.interfaces import TranslationUnavailable
22+from canonical.launchpad.webapp.interfaces import (
23+ NoReferrerError, TranslationUnavailable)
24 from lazr.restful.declarations import webservice_error
25 from lp.services.osutils import remove_tree
26 from lp.testing import TestCase
27@@ -693,6 +694,24 @@
28 errorfile = os.path.join(utility.errordir(now), '01800.T1')
29 self.assertFalse(os.path.exists(errorfile))
30
31+ def test_raising_no_referrer_error(self):
32+ """Test ErrorReportingUtility.raising() with a NoReferrerError
33+ exception.
34+
35+ An OOPS is not recorded when a NoReferrerError exception is
36+ raised.
37+ """
38+ utility = ErrorReportingUtility()
39+ now = datetime.datetime(2006, 04, 01, 00, 30, 00, tzinfo=UTC)
40+
41+ try:
42+ raise NoReferrerError('xyz')
43+ except NoReferrerError:
44+ utility.raising(sys.exc_info(), now=now)
45+
46+ errorfile = os.path.join(utility.errordir(now), '01800.T1')
47+ self.assertFalse(os.path.exists(errorfile))
48+
49 def test_raising_with_string_as_traceback(self):
50 # ErrorReportingUtility.raising() can be called with a string in the
51 # place of a traceback. This is useful when the original traceback