launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24982
[Merge] ~cjwatson/launchpad:py3-function-instancemethod-attributes into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-function-instancemethod-attributes into launchpad:master.
Commit message:
Use modern names for function and instance method attributes
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/387083
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-function-instancemethod-attributes into launchpad:master.
diff --git a/lib/lp/bugs/tests/test_bugtarget.py b/lib/lp/bugs/tests/test_bugtarget.py
index 8ed9abd..9f1c5f4 100644
--- a/lib/lp/bugs/tests/test_bugtarget.py
+++ b/lib/lp/bugs/tests/test_bugtarget.py
@@ -185,7 +185,7 @@ def test_suite():
testname = 'bugtarget-questiontarget.txt'
for setUpMethod in setUpMethods:
- id_ext = "%s-%s" % (testname, setUpMethod.func_name)
+ id_ext = "%s-%s" % (testname, setUpMethod.__name__)
test = LayeredDocFileSuite(
testname,
id_extensions=[id_ext],
diff --git a/lib/lp/bugs/tests/test_structuralsubscriptiontarget.py b/lib/lp/bugs/tests/test_structuralsubscriptiontarget.py
index 0d81144..c7a8107 100644
--- a/lib/lp/bugs/tests/test_structuralsubscriptiontarget.py
+++ b/lib/lp/bugs/tests/test_structuralsubscriptiontarget.py
@@ -556,7 +556,7 @@ def test_suite():
testname = 'structural-subscription-target.txt'
for setUpMethod in setUpMethods:
- id_ext = "%s-%s" % (testname, setUpMethod.func_name)
+ id_ext = "%s-%s" % (testname, setUpMethod.__name__)
test = LayeredDocFileSuite(
testname,
id_extensions=[id_ext],
diff --git a/lib/lp/services/webapp/menu.py b/lib/lp/services/webapp/menu.py
index efafa83..2eda2f9 100644
--- a/lib/lp/services/webapp/menu.py
+++ b/lib/lp/services/webapp/menu.py
@@ -69,7 +69,7 @@ def get_current_view(request=None):
# Note: The last traversed object may be a view's instance method.
bare = removeSecurityProxy(view)
if zope_isinstance(view, types.MethodType):
- return bare.im_self
+ return bare.__self__
return bare
diff --git a/lib/lp/services/webapp/publication.py b/lib/lp/services/webapp/publication.py
index aa32e00..8e153b3 100644
--- a/lib/lp/services/webapp/publication.py
+++ b/lib/lp/services/webapp/publication.py
@@ -435,7 +435,7 @@ class LaunchpadBrowserPublication(
# The view may be security proxied
view = removeSecurityProxy(ob)
# It's possible that the view is a bound method.
- view = getattr(view, 'im_self', view)
+ view = getattr(view, '__self__', view)
context = removeSecurityProxy(getattr(view, 'context', None))
pageid = self.constructPageID(view, context)
request.setInWSGIEnvironment('launchpad.pageid', pageid)
diff --git a/lib/lp/testing/breadcrumbs.py b/lib/lp/testing/breadcrumbs.py
index 33d2845..14575a5 100644
--- a/lib/lp/testing/breadcrumbs.py
+++ b/lib/lp/testing/breadcrumbs.py
@@ -52,6 +52,6 @@ class BaseBreadcrumbTestCase(TestCaseWithFactory):
obj, view, request = test_traverse(url)
# Sometimes test_traverse returns the __call__, while the template
# always has access to the instance.
- view = getattr(removeSecurityProxy(view), 'im_self', view)
+ view = getattr(removeSecurityProxy(view), '__self__', view)
hier = create_initialized_view(view, '+hierarchy', request=request)
return hier.items
diff --git a/utilities/roundup-sniffer.py b/utilities/roundup-sniffer.py
index c101ecc..224da01 100755
--- a/utilities/roundup-sniffer.py
+++ b/utilities/roundup-sniffer.py
@@ -87,7 +87,7 @@ class RoundupSniffer:
return list(bugs)
def get_text_values(self, bug):
- raise NotImplementedError(self.get_text_values.func_name)
+ raise NotImplementedError(self.get_text_values.__name__)
class MplayerStatusSniffer(RoundupSniffer):