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
=== modified file 'lib/canonical/launchpad/webapp/errorlog.py'
--- lib/canonical/launchpad/webapp/errorlog.py 2009-11-26 21:25:17 +0000
+++ lib/canonical/launchpad/webapp/errorlog.py 2010-05-05 01:47:26 +0000
@@ -231,7 +231,7 @@
231231
232 _ignored_exceptions = set([232 _ignored_exceptions = set([
233 'ReadOnlyModeDisallowedStore', 'ReadOnlyModeViolation',233 'ReadOnlyModeDisallowedStore', 'ReadOnlyModeViolation',
234 'TranslationUnavailable'])234 'TranslationUnavailable', 'NoReferrerError'])
235 _ignored_exceptions_for_unauthenticated_users = set(['Unauthorized'])235 _ignored_exceptions_for_unauthenticated_users = set(['Unauthorized'])
236 _default_config_section = 'error_reports'236 _default_config_section = 'error_reports'
237237
238238
=== modified file 'lib/canonical/launchpad/webapp/tests/test_errorlog.py'
--- lib/canonical/launchpad/webapp/tests/test_errorlog.py 2010-01-21 03:52:05 +0000
+++ lib/canonical/launchpad/webapp/tests/test_errorlog.py 2010-05-05 01:47:26 +0000
@@ -34,7 +34,8 @@
34from canonical.launchpad.webapp.errorlog import (34from canonical.launchpad.webapp.errorlog import (
35 ErrorReport, ErrorReportingUtility, OopsLoggingHandler, ScriptRequest,35 ErrorReport, ErrorReportingUtility, OopsLoggingHandler, ScriptRequest,
36 _is_sensitive)36 _is_sensitive)
37from canonical.launchpad.webapp.interfaces import TranslationUnavailable37from canonical.launchpad.webapp.interfaces import (
38 NoReferrerError, TranslationUnavailable)
38from lazr.restful.declarations import webservice_error39from lazr.restful.declarations import webservice_error
39from lp.services.osutils import remove_tree40from lp.services.osutils import remove_tree
40from lp.testing import TestCase41from lp.testing import TestCase
@@ -693,6 +694,24 @@
693 errorfile = os.path.join(utility.errordir(now), '01800.T1')694 errorfile = os.path.join(utility.errordir(now), '01800.T1')
694 self.assertFalse(os.path.exists(errorfile))695 self.assertFalse(os.path.exists(errorfile))
695696
697 def test_raising_no_referrer_error(self):
698 """Test ErrorReportingUtility.raising() with a NoReferrerError
699 exception.
700
701 An OOPS is not recorded when a NoReferrerError exception is
702 raised.
703 """
704 utility = ErrorReportingUtility()
705 now = datetime.datetime(2006, 04, 01, 00, 30, 00, tzinfo=UTC)
706
707 try:
708 raise NoReferrerError('xyz')
709 except NoReferrerError:
710 utility.raising(sys.exc_info(), now=now)
711
712 errorfile = os.path.join(utility.errordir(now), '01800.T1')
713 self.assertFalse(os.path.exists(errorfile))
714
696 def test_raising_with_string_as_traceback(self):715 def test_raising_with_string_as_traceback(self):
697 # ErrorReportingUtility.raising() can be called with a string in the716 # ErrorReportingUtility.raising() can be called with a string in the
698 # place of a traceback. This is useful when the original traceback717 # place of a traceback. This is useful when the original traceback