launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25608
[Merge] ~cjwatson/launchpad:redirection-view-debug into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:redirection-view-debug into launchpad:master.
Commit message:
Make RedirectionView.context AttributeError more informative
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/393319
It can otherwise be hard to figure out exactly what URL we're refusing to handle.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:redirection-view-debug into launchpad:master.
diff --git a/lib/lp/services/webapp/publisher.py b/lib/lp/services/webapp/publisher.py
index 199be4b..17c9d81 100644
--- a/lib/lp/services/webapp/publisher.py
+++ b/lib/lp/services/webapp/publisher.py
@@ -1143,7 +1143,7 @@ class RedirectionView(URLDereferencingMixin):
if parsed_target[:2] not in supported_roots:
raise AttributeError(
"RedirectionView.context is only supported for URLs served "
- "by the main Launchpad application.")
+ "by the main Launchpad application, not '%s'." % self.target)
return self.dereference_url_as_object(self.target)
diff --git a/lib/lp/services/webapp/tests/test_publisher.py b/lib/lp/services/webapp/tests/test_publisher.py
index 5eee7c6..40e4fcd 100644
--- a/lib/lp/services/webapp/tests/test_publisher.py
+++ b/lib/lp/services/webapp/tests/test_publisher.py
@@ -423,7 +423,7 @@ class TestRedirectionView(TestCase):
view = RedirectionView("http://canonical.com", request)
expected_msg = (
"RedirectionView.context is only supported for URLs served by the "
- "main Launchpad application.")
+ "main Launchpad application, not 'http://canonical.com'.")
self.assertRaisesWithContent(
AttributeError, expected_msg, getattr, view, "context")