launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00413
[Merge] lp:~jml/launchpad/shout-more-effectively into lp:launchpad/devel
Jonathan Lange has proposed merging lp:~jml/launchpad/shout-more-effectively into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This branch changes the warning generated by remove_security_proxy_and_shout_at_engineer to more clearly indicate what you should do.
--
https://code.launchpad.net/~jml/launchpad/shout-more-effectively/+merge/31664
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jml/launchpad/shout-more-effectively into lp:launchpad/devel.
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2010-08-01 04:34:26 +0000
+++ lib/lp/testing/factory.py 2010-08-03 17:31:47 +0000
@@ -31,7 +31,6 @@
import os.path
from random import randint
from StringIO import StringIO
-import sys
from textwrap import dedent
from threading import local
from types import InstanceType
@@ -2797,17 +2796,14 @@
"unproxied object." % (method_name,))
-class UnreasonableRemoveSecurityProxyWarning(UserWarning):
- """Raised when there is an unreasonable call to removeSecurityProxy."""
-
- # XXX: JonathanLange 2010-07-25: I have no idea what "unreasonable" means
- # in this context.
+class ShouldThisBeUsingRemoveSecurityProxy(UserWarning):
+ """Raised when there is a potentially bad call to removeSecurityProxy."""
def __init__(self, obj):
message = (
- "Called removeSecurityProxy(%r) without a check if this is "
- "reasonable." % obj)
- super(UnreasonableRemoveSecurityProxyWarning, self).__init__(message)
+ "removeSecurityProxy(%r) called. Is this correct? "
+ "Either call it directly or fix the test." % obj)
+ super(ShouldThisBeUsingRemoveSecurityProxy, self).__init__(message)
class LaunchpadObjectFactory:
@@ -2850,5 +2846,5 @@
This function should only be used in legacy tests which fail because
they expect unproxied objects.
"""
- warnings.warn(UnreasonableRemoveSecurityProxyWarning(obj), stacklevel=2)
+ warnings.warn(ShouldThisBeUsingRemoveSecurityProxy(obj), stacklevel=2)
return removeSecurityProxy(obj)