Merge ~cjwatson/launchpad:pyupgrade-py3-registry-1 into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 00f8fbecbdad86d49383674e68c4fa662cf5fc1e
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:pyupgrade-py3-registry-1
Merge into: launchpad:master
Diff against target: 3377 lines (+405/-423)
54 files modified
.git-blame-ignore-revs (+2/-0)
.pre-commit-config.yaml (+1/-0)
lib/lp/registry/browser/codeofconduct.py (+1/-1)
lib/lp/registry/browser/distribution.py (+10/-10)
lib/lp/registry/browser/distributionsourcepackage.py (+3/-4)
lib/lp/registry/browser/distroseries.py (+14/-14)
lib/lp/registry/browser/distroseriesdifference.py (+1/-1)
lib/lp/registry/browser/distroseriesdifferencecomment.py (+1/-2)
lib/lp/registry/browser/featuredproject.py (+1/-1)
lib/lp/registry/browser/mailinglists.py (+10/-10)
lib/lp/registry/browser/milestone.py (+9/-9)
lib/lp/registry/browser/objectreassignment.py (+1/-1)
lib/lp/registry/browser/ociproject.py (+5/-5)
lib/lp/registry/browser/peoplemerge.py (+7/-9)
lib/lp/registry/browser/person.py (+40/-45)
lib/lp/registry/browser/pillar.py (+3/-3)
lib/lp/registry/browser/poll.py (+2/-2)
lib/lp/registry/browser/product.py (+26/-26)
lib/lp/registry/browser/productrelease.py (+4/-4)
lib/lp/registry/browser/productseries.py (+4/-5)
lib/lp/registry/browser/project.py (+4/-4)
lib/lp/registry/browser/sourcepackage.py (+5/-5)
lib/lp/registry/browser/team.py (+15/-19)
lib/lp/registry/browser/teammembership.py (+1/-1)
lib/lp/registry/browser/tests/test_announcements.py (+4/-4)
lib/lp/registry/browser/tests/test_branding.py (+1/-1)
lib/lp/registry/browser/tests/test_breadcrumbs.py (+7/-7)
lib/lp/registry/browser/tests/test_codeofconduct.py (+2/-2)
lib/lp/registry/browser/tests/test_distribution.py (+4/-4)
lib/lp/registry/browser/tests/test_distribution_views.py (+12/-12)
lib/lp/registry/browser/tests/test_distributionsourcepackage.py (+3/-3)
lib/lp/registry/browser/tests/test_distroseries.py (+57/-62)
lib/lp/registry/browser/tests/test_distroseriesdifference_views.py (+4/-4)
lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py (+9/-9)
lib/lp/registry/browser/tests/test_edit_permissions.py (+1/-1)
lib/lp/registry/browser/tests/test_mailinglists.py (+1/-1)
lib/lp/registry/browser/tests/test_milestone.py (+15/-15)
lib/lp/registry/browser/tests/test_ociproject.py (+1/-1)
lib/lp/registry/browser/tests/test_packaging.py (+3/-3)
lib/lp/registry/browser/tests/test_peoplemerge.py (+15/-15)
lib/lp/registry/browser/tests/test_person.py (+37/-38)
lib/lp/registry/browser/tests/test_person_contact.py (+1/-1)
lib/lp/registry/browser/tests/test_person_webservice.py (+9/-9)
lib/lp/registry/browser/tests/test_pillar_sharing.py (+5/-5)
lib/lp/registry/browser/tests/test_poll.py (+2/-2)
lib/lp/registry/browser/tests/test_product.py (+5/-5)
lib/lp/registry/browser/tests/test_projectgroup.py (+2/-2)
lib/lp/registry/browser/tests/test_reassign_team_view.py (+1/-1)
lib/lp/registry/browser/tests/test_sourcepackage_views.py (+1/-1)
lib/lp/registry/browser/tests/test_subscription_links.py (+20/-21)
lib/lp/registry/browser/tests/test_team.py (+8/-8)
lib/lp/registry/browser/tests/test_teammembership.py (+1/-1)
lib/lp/registry/browser/widgets/ocicredentialswidget.py (+1/-1)
lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py (+3/-3)
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+413506@code.launchpad.net

Commit message

lp.registry.browser: Apply "pyupgrade --py3-plus"

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

Self-approving (mechanical).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index a251b8f..c594c33 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -28,3 +28,5 @@ cee9b128d3e49ca814464eeeeec50e6bcabcc4ba
28f36fe66e5e5a5e82ba8c3269e32d76bd573d117528f36fe66e5e5a5e82ba8c3269e32d76bd573d1175
29# apply pyupgrade --py3-plus to lp.{coop,oci}29# apply pyupgrade --py3-plus to lp.{coop,oci}
30fbed83f22424df8fa5647349493f78937a520db530fbed83f22424df8fa5647349493f78937a520db5
31# apply pyupgrade --py3-plus to lp.registry.browser
329c1665b1dfed3f6abf69afa192700172ea3089a1
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 22c2329..784ae6a 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -52,6 +52,7 @@ repos:
52 |codehosting52 |codehosting
53 |coop53 |coop
54 |oci54 |oci
55 |registry/browser
55 )/56 )/
56- repo: https://github.com/PyCQA/isort57- repo: https://github.com/PyCQA/isort
57 rev: 5.9.258 rev: 5.9.2
diff --git a/lib/lp/registry/browser/codeofconduct.py b/lib/lp/registry/browser/codeofconduct.py
index 65fc254..cda21f9 100644
--- a/lib/lp/registry/browser/codeofconduct.py
+++ b/lib/lp/registry/browser/codeofconduct.py
@@ -175,7 +175,7 @@ class AffirmCodeOfConductView(LaunchpadFormView):
175175
176 affirmed = copy_field(176 affirmed = copy_field(
177 ISignedCodeOfConduct["affirmed"],177 ISignedCodeOfConduct["affirmed"],
178 title=_("I agree to this Code of Conduct"), description=u"")178 title=_("I agree to this Code of Conduct"), description="")
179179
180 field_names = ['affirmed']180 field_names = ['affirmed']
181181
diff --git a/lib/lp/registry/browser/distribution.py b/lib/lp/registry/browser/distribution.py
index 741fab0..025e405 100644
--- a/lib/lp/registry/browser/distribution.py
+++ b/lib/lp/registry/browser/distribution.py
@@ -372,7 +372,7 @@ class DistributionNavigationMenu(NavigationMenu, DistributionLinksMixin):
372372
373 def search_oci_project(self):373 def search_oci_project(self):
374 oci_projects = getUtility(IOCIProjectSet).findByPillarAndName(374 oci_projects = getUtility(IOCIProjectSet).findByPillarAndName(
375 self.context, u'')375 self.context, '')
376 text = 'Search for OCI project'376 text = 'Search for OCI project'
377 link = Link('+search-oci-project', text, icon='info')377 link = Link('+search-oci-project', text, icon='info')
378 link.enabled = not oci_projects.is_empty()378 link.enabled = not oci_projects.is_empty()
@@ -574,7 +574,7 @@ class DistributionPackageSearchView(PackageSearchViewBase):
574574
575 def initialize(self):575 def initialize(self):
576 """Save the search type if provided."""576 """Save the search type if provided."""
577 super(DistributionPackageSearchView, self).initialize()577 super().initialize()
578578
579 # If the distribution contains binary packages, then we'll579 # If the distribution contains binary packages, then we'll
580 # default to searches on binary names, but allow the user to580 # default to searches on binary names, but allow the user to
@@ -704,7 +704,7 @@ class DistributionView(PillarViewMixin, HasAnnouncementsView, FeedsMixin):
704 """Default Distribution view class."""704 """Default Distribution view class."""
705705
706 def initialize(self):706 def initialize(self):
707 super(DistributionView, self).initialize()707 super().initialize()
708 expose_structural_subscription_data_to_js(708 expose_structural_subscription_data_to_js(
709 self.context, self.request, self.user)709 self.context, self.request, self.user)
710710
@@ -902,9 +902,9 @@ class RequireVirtualizedBuildersMixin:
902 return form.Fields(902 return form.Fields(
903 Bool(903 Bool(
904 __name__='require_virtualized',904 __name__='require_virtualized',
905 title=u"Require virtualized builders",905 title="Require virtualized builders",
906 description=(906 description=(
907 u"Only build the distribution's packages on virtual "907 "Only build the distribution's packages on virtual "
908 "builders."),908 "builders."),
909 required=True))909 required=True))
910910
@@ -956,8 +956,8 @@ class DistributionAddView(LaunchpadFormView, RequireVirtualizedBuildersMixin,
956 self.form_fields += self.createRequireVirtualized()956 self.form_fields += self.createRequireVirtualized()
957 self.form_fields += self.createEnabledProcessors(957 self.form_fields += self.createEnabledProcessors(
958 getUtility(IProcessorSet).getAll(),958 getUtility(IProcessorSet).getAll(),
959 u"The architectures on which the distribution's main archive can "959 "The architectures on which the distribution's main archive can "
960 u"build.")960 "build.")
961961
962 @action("Save", name='save')962 @action("Save", name='save')
963 def save_action(self, action, data):963 def save_action(self, action, data):
@@ -1028,8 +1028,8 @@ class DistributionEditView(RegistryEditFormView,
1028 self.form_fields += self.createRequireVirtualized()1028 self.form_fields += self.createRequireVirtualized()
1029 self.form_fields += self.createEnabledProcessors(1029 self.form_fields += self.createEnabledProcessors(
1030 getUtility(IProcessorSet).getAll(),1030 getUtility(IProcessorSet).getAll(),
1031 u"The architectures on which the distribution's main archive can "1031 "The architectures on which the distribution's main archive can "
1032 u"build.")1032 "build.")
10331033
1034 @property1034 @property
1035 def initial_values(self):1035 def initial_values(self):
@@ -1195,7 +1195,7 @@ class DistributionCountryArchiveMirrorsView(LaunchpadView):
1195 request = self.request1195 request = self.request
1196 if not self.context.supports_mirrors:1196 if not self.context.supports_mirrors:
1197 request.response.setStatus(404)1197 request.response.setStatus(404)
1198 return u''1198 return ''
1199 ip_address = ipaddress_from_request(request)1199 ip_address = ipaddress_from_request(request)
1200 country = request_country(request)1200 country = request_country(request)
1201 mirrors = getUtility(IDistributionMirrorSet).getBestMirrorsForCountry(1201 mirrors = getUtility(IDistributionMirrorSet).getBestMirrorsForCountry(
diff --git a/lib/lp/registry/browser/distributionsourcepackage.py b/lib/lp/registry/browser/distributionsourcepackage.py
index 48def0c..1d09774 100644
--- a/lib/lp/registry/browser/distributionsourcepackage.py
+++ b/lib/lp/registry/browser/distributionsourcepackage.py
@@ -22,7 +22,6 @@ import operator
2222
23import apt_pkg23import apt_pkg
24from lazr.delegates import delegate_to24from lazr.delegates import delegate_to
25import six
26from zope.component import getUtility25from zope.component import getUtility
27from zope.interface import (26from zope.interface import (
28 implementer,27 implementer,
@@ -119,7 +118,7 @@ class DistributionSourcePackageURL:
119 not self.context.distribution.redirect_default_traversal):118 not self.context.distribution.redirect_default_traversal):
120 return self.context.name119 return self.context.name
121 else:120 else:
122 return u"+source/%s" % self.context.name121 return "+source/%s" % self.context.name
123122
124123
125class DistributionSourcePackageFormatterAPI(CustomizableFormatter):124class DistributionSourcePackageFormatterAPI(CustomizableFormatter):
@@ -298,7 +297,7 @@ class DistributionSourcePackageBaseView(LaunchpadView):
298297
299 def not_empty(text):298 def not_empty(text):
300 return (299 return (
301 text is not None and isinstance(text, six.string_types)300 text is not None and isinstance(text, str)
302 and len(text.strip()) > 0)301 and len(text.strip()) > 0)
303302
304 def decorate(dspr_pubs):303 def decorate(dspr_pubs):
@@ -341,7 +340,7 @@ class DistributionSourcePackageView(DistributionSourcePackageBaseView,
341 """View class for DistributionSourcePackage."""340 """View class for DistributionSourcePackage."""
342341
343 def initialize(self):342 def initialize(self):
344 super(DistributionSourcePackageView, self).initialize()343 super().initialize()
345 expose_structural_subscription_data_to_js(344 expose_structural_subscription_data_to_js(
346 self.context, self.request, self.user)345 self.context, self.request, self.user)
347346
diff --git a/lib/lp/registry/browser/distroseries.py b/lib/lp/registry/browser/distroseries.py
index 6b162dc..0834c89 100644
--- a/lib/lp/registry/browser/distroseries.py
+++ b/lib/lp/registry/browser/distroseries.py
@@ -159,7 +159,7 @@ class DistroSeriesURL:
159 not self.context.distribution.redirect_default_traversal):159 not self.context.distribution.redirect_default_traversal):
160 return self.context.name160 return self.context.name
161 else:161 else:
162 return u"+series/%s" % self.context.name162 return "+series/%s" % self.context.name
163163
164164
165class DistroSeriesNavigation(GetitemNavigation, BugTargetTraversalMixin,165class DistroSeriesNavigation(GetitemNavigation, BugTargetTraversalMixin,
@@ -439,7 +439,7 @@ class DistroSeriesView(LaunchpadView, MilestoneOverlayMixin,
439 DerivedDistroSeriesMixin):439 DerivedDistroSeriesMixin):
440440
441 def initialize(self):441 def initialize(self):
442 super(DistroSeriesView, self).initialize()442 super().initialize()
443 self.displayname = '%s %s' % (443 self.displayname = '%s %s' % (
444 self.context.distribution.displayname,444 self.context.distribution.displayname,
445 self.context.version)445 self.context.version)
@@ -709,7 +709,7 @@ class DistroSeriesAddView(LaunchpadFormView):
709 ]709 ]
710710
711 help_links = {711 help_links = {
712 "name": u"/+help-registry/distribution-add-series.html#codename",712 "name": "/+help-registry/distribution-add-series.html#codename",
713 }713 }
714714
715 label = 'Add a series'715 label = 'Add a series'
@@ -729,7 +729,7 @@ class DistroSeriesAddView(LaunchpadFormView):
729 display_name=data['display_name'],729 display_name=data['display_name'],
730 title=data['display_name'],730 title=data['display_name'],
731 summary=data['summary'],731 summary=data['summary'],
732 description=u"",732 description="",
733 version=data['version'],733 version=data['version'],
734 previous_series=previous_series,734 previous_series=previous_series,
735 registrant=self.user)735 registrant=self.user)
@@ -765,7 +765,7 @@ class DistroSeriesInitializeView(LaunchpadFormView):
765 page_title = label765 page_title = label
766766
767 def initialize(self):767 def initialize(self):
768 super(DistroSeriesInitializeView, self).initialize()768 super().initialize()
769 cache = IJSONRequestCache(self.request).objects769 cache = IJSONRequestCache(self.request).objects
770 distribution = self.context.distribution770 distribution = self.context.distribution
771 is_first_derivation = not distribution.has_published_sources771 is_first_derivation = not distribution.has_published_sources
@@ -778,7 +778,7 @@ class DistroSeriesInitializeView(LaunchpadFormView):
778 cache['previous_parents'] = [778 cache['previous_parents'] = [
779 seriesToVocab(series) for series in previous_parents]779 seriesToVocab(series) for series in previous_parents]
780780
781 @action(u"Initialize Series", name='initialize')781 @action("Initialize Series", name='initialize')
782 def submit(self, action, data):782 def submit(self, action, data):
783 """Stub for the Javascript in the page to use."""783 """Stub for the Javascript in the page to use."""
784784
@@ -888,7 +888,7 @@ class IDifferencesFormSchema(Interface):
888 required=True)888 required=True)
889889
890 sponsored_person = Choice(890 sponsored_person = Choice(
891 title=u"Person being sponsored", vocabulary='ValidPerson',891 title="Person being sponsored", vocabulary='ValidPerson',
892 required=False)892 required=False)
893893
894894
@@ -954,7 +954,7 @@ class DistroSeriesDifferenceBaseView(LaunchpadFormView,
954 As this field depends on other search/filtering field values954 As this field depends on other search/filtering field values
955 for its own vocabulary, we set it up after all the others.955 for its own vocabulary, we set it up after all the others.
956 """956 """
957 super(DistroSeriesDifferenceBaseView, self).setUpFields()957 super().setUpFields()
958 self.form_fields = (958 self.form_fields = (
959 self.setupPackageFilterRadio() +959 self.setupPackageFilterRadio() +
960 self.form_fields)960 self.form_fields)
@@ -1231,7 +1231,7 @@ class DistroSeriesLocalDifferencesView(DistroSeriesDifferenceBaseView,
1231 parent_name,1231 parent_name,
1232 self.context.displayname,1232 self.context.displayname,
1233 ))1233 ))
1234 super(DistroSeriesLocalDifferencesView, self).initialize()1234 super().initialize()
12351235
1236 @property1236 @property
1237 def explanation(self):1237 def explanation(self):
@@ -1294,9 +1294,9 @@ class DistroSeriesLocalDifferencesView(DistroSeriesDifferenceBaseView,
1294 copies, self.user, copy_policy=PackageCopyPolicy.MASS_SYNC)1294 copies, self.user, copy_policy=PackageCopyPolicy.MASS_SYNC)
12951295
1296 self.request.response.addInfoNotification(1296 self.request.response.addInfoNotification(
1297 (u"Upgrades of {context.displayname} packages have been "1297 ("Upgrades of {context.displayname} packages have been "
1298 u"requested. Please give Launchpad some time to complete "1298 "requested. Please give Launchpad some time to complete "
1299 u"these.").format(context=self.context))1299 "these.").format(context=self.context))
13001300
1301 def canUpgrade(self, action=None):1301 def canUpgrade(self, action=None):
1302 """Should the form offer a packages upgrade?"""1302 """Should the form offer a packages upgrade?"""
@@ -1330,7 +1330,7 @@ class DistroSeriesMissingPackagesView(DistroSeriesDifferenceBaseView,
1330 "Include Selected packages into %s" % (1330 "Include Selected packages into %s" % (
1331 self.context.displayname,1331 self.context.displayname,
1332 ))1332 ))
1333 super(DistroSeriesMissingPackagesView, self).initialize()1333 super().initialize()
13341334
1335 @property1335 @property
1336 def explanation(self):1336 def explanation(self):
@@ -1369,7 +1369,7 @@ class DistroSeriesUniquePackagesView(DistroSeriesDifferenceBaseView,
1369 show_packagesets = True1369 show_packagesets = True
13701370
1371 def initialize(self):1371 def initialize(self):
1372 super(DistroSeriesUniquePackagesView, self).initialize()1372 super().initialize()
13731373
1374 @property1374 @property
1375 def explanation(self):1375 def explanation(self):
diff --git a/lib/lp/registry/browser/distroseriesdifference.py b/lib/lp/registry/browser/distroseriesdifference.py
index 717cb88..ddcd915 100644
--- a/lib/lp/registry/browser/distroseriesdifference.py
+++ b/lib/lp/registry/browser/distroseriesdifference.py
@@ -258,7 +258,7 @@ class DistroSeriesDifferenceDisplayComment(MessageComment):
258258
259 def __init__(self, comment):259 def __init__(self, comment):
260 """Setup the attributes required by `IComment`."""260 """Setup the attributes required by `IComment`."""
261 super(DistroSeriesDifferenceDisplayComment, self).__init__(None)261 super().__init__(None)
262 self.comment = comment262 self.comment = comment
263 self._message = comment.message263 self._message = comment.message
264264
diff --git a/lib/lp/registry/browser/distroseriesdifferencecomment.py b/lib/lp/registry/browser/distroseriesdifferencecomment.py
index 6d1a8a1..5bb0c86 100644
--- a/lib/lp/registry/browser/distroseriesdifferencecomment.py
+++ b/lib/lp/registry/browser/distroseriesdifferencecomment.py
@@ -18,7 +18,6 @@ class DistroSeriesDifferenceCommentView(LaunchpadView):
18 """18 """
1919
20 def __init__(self, *args, **kwargs):20 def __init__(self, *args, **kwargs):
21 super(DistroSeriesDifferenceCommentView, self).__init__(21 super().__init__(*args, **kwargs)
22 *args, **kwargs)
23 error_persona = getUtility(ILaunchpadCelebrities).janitor22 error_persona = getUtility(ILaunchpadCelebrities).janitor
24 self.is_error = (self.context.comment_author == error_persona)23 self.is_error = (self.context.comment_author == error_persona)
diff --git a/lib/lp/registry/browser/featuredproject.py b/lib/lp/registry/browser/featuredproject.py
index c77adcb..214eede 100644
--- a/lib/lp/registry/browser/featuredproject.py
+++ b/lib/lp/registry/browser/featuredproject.py
@@ -34,7 +34,7 @@ class FeaturedProjectForm(Interface):
34 required=False, vocabulary='DistributionOrProductOrProjectGroup')34 required=False, vocabulary='DistributionOrProductOrProjectGroup')
3535
36 remove = Set(36 remove = Set(
37 title=u'Remove projects',37 title='Remove projects',
38 description=_(38 description=_(
39 'Select projects that you would like to remove from the list.'),39 'Select projects that you would like to remove from the list.'),
40 required=False,40 required=False,
diff --git a/lib/lp/registry/browser/mailinglists.py b/lib/lp/registry/browser/mailinglists.py
index ea8c6ed..bbc26a2 100644
--- a/lib/lp/registry/browser/mailinglists.py
+++ b/lib/lp/registry/browser/mailinglists.py
@@ -28,7 +28,7 @@ class HeldMessageView(LaunchpadView):
28 """A little helper view for held messages."""28 """A little helper view for held messages."""
2929
30 def __init__(self, context, request):30 def __init__(self, context, request):
31 super(HeldMessageView, self).__init__(context, request)31 super().__init__(context, request)
32 self.context = context32 self.context = context
33 self.request = request33 self.request = request
34 # The context object is an IMessageApproval, but we need some extra34 # The context object is an IMessageApproval, but we need some extra
@@ -74,16 +74,16 @@ class HeldMessageView(LaunchpadView):
74 else:74 else:
75 current_paragraph.append(line)75 current_paragraph.append(line)
76 self._append_paragraph(paragraphs, current_paragraph)76 self._append_paragraph(paragraphs, current_paragraph)
77 self.body_details = u''.join(paragraphs)77 self.body_details = ''.join(paragraphs)
7878
79 def _append_paragraph(self, paragraphs, current_paragraph):79 def _append_paragraph(self, paragraphs, current_paragraph):
80 if len(current_paragraph) == 0:80 if len(current_paragraph) == 0:
81 # There is nothing to append. The message has multiple81 # There is nothing to append. The message has multiple
82 # blank lines.82 # blank lines.
83 return83 return
84 paragraphs.append(u'\n<p>\n')84 paragraphs.append('\n<p>\n')
85 paragraphs.append(u'\n'.join(current_paragraph))85 paragraphs.append('\n'.join(current_paragraph))
86 paragraphs.append(u'\n</p>\n')86 paragraphs.append('\n</p>\n')
8787
88 def _remove_leading_blank_lines(self):88 def _remove_leading_blank_lines(self):
89 """Strip off any leading blank lines.89 """Strip off any leading blank lines.
@@ -113,13 +113,13 @@ class HeldMessageView(LaunchpadView):
113 """113 """
114 # If there are no non-blank lines, then we're done.114 # If there are no non-blank lines, then we're done.
115 if len(text_lines) == 0:115 if len(text_lines) == 0:
116 self.body_summary = u''116 self.body_summary = ''
117 return u''117 return ''
118 # If the first line is of a completely arbitrarily chosen reasonable118 # If the first line is of a completely arbitrarily chosen reasonable
119 # length, then we'll just use that as the summary.119 # length, then we'll just use that as the summary.
120 elif len(text_lines[0]) < 60:120 elif len(text_lines[0]) < 60:
121 self.body_summary = text_lines[0]121 self.body_summary = text_lines[0]
122 return u'\n'.join(text_lines[1:])122 return '\n'.join(text_lines[1:])
123 # It could be the case that the text is actually flowed using RFC123 # It could be the case that the text is actually flowed using RFC
124 # 3676 format="flowed" parameters. In that case, just split the line124 # 3676 format="flowed" parameters. In that case, just split the line
125 # at the first whitespace after, again, our arbitrarily chosen limit.125 # at the first whitespace after, again, our arbitrarily chosen limit.
@@ -128,8 +128,8 @@ class HeldMessageView(LaunchpadView):
128 wrapper = TextWrapper(width=60)128 wrapper = TextWrapper(width=60)
129 filled_lines = wrapper.fill(first_line).splitlines()129 filled_lines = wrapper.fill(first_line).splitlines()
130 self.body_summary = filled_lines[0]130 self.body_summary = filled_lines[0]
131 text_lines.insert(0, u''.join(filled_lines[1:]))131 text_lines.insert(0, ''.join(filled_lines[1:]))
132 return u'\n'.join(text_lines)132 return '\n'.join(text_lines)
133133
134134
135class enabled_with_active_mailing_list:135class enabled_with_active_mailing_list:
diff --git a/lib/lp/registry/browser/milestone.py b/lib/lp/registry/browser/milestone.py
index 3d2724e..375f5e4 100644
--- a/lib/lp/registry/browser/milestone.py
+++ b/lib/lp/registry/browser/milestone.py
@@ -194,7 +194,7 @@ class MilestoneInlineNavigationMenu(NavigationMenu, MilestoneLinkMixin):
194 links = ('edit', )194 links = ('edit', )
195195
196196
197class MilestoneViewMixin(object):197class MilestoneViewMixin:
198 """Common methods shared between MilestoneView and MilestoneTagView."""198 """Common methods shared between MilestoneView and MilestoneTagView."""
199199
200 @property200 @property
@@ -366,7 +366,7 @@ class MilestoneView(
366 :param context: `IMilestone` or `IProductRelease`.366 :param context: `IMilestone` or `IProductRelease`.
367 :param request: `ILaunchpadRequest`.367 :param request: `ILaunchpadRequest`.
368 """368 """
369 super(MilestoneView, self).__init__(context, request)369 super().__init__(context, request)
370 if IMilestoneData.providedBy(context):370 if IMilestoneData.providedBy(context):
371 self.milestone = context371 self.milestone = context
372 self.release = getattr(context, "product_release", None)372 self.release = getattr(context, "product_release", None)
@@ -431,7 +431,7 @@ class MilestoneTagBase:
431 on the interface.431 on the interface.
432 """432 """
433 tag_entry = TextLine(433 tag_entry = TextLine(
434 __name__='tags', title=u'Tags', required=False,434 __name__='tags', title='Tags', required=False,
435 constraint=lambda value: validate_tags(value.split()))435 constraint=lambda value: validate_tags(value.split()))
436 self.form_fields += form.Fields(436 self.form_fields += form.Fields(
437 tag_entry, render_context=self.render_context)437 tag_entry, render_context=self.render_context)
@@ -512,7 +512,7 @@ class MilestoneEditView(MilestoneTagBase, LaunchpadEditFormView):
512512
513 @property513 @property
514 def initial_values(self):514 def initial_values(self):
515 return {'tags': u' '.join(self.context.getTags())}515 return {'tags': ' '.join(self.context.getTags())}
516516
517 def setUpFields(self):517 def setUpFields(self):
518 """See `LaunchpadFormView`.518 """See `LaunchpadFormView`.
@@ -521,7 +521,7 @@ class MilestoneEditView(MilestoneTagBase, LaunchpadEditFormView):
521 create the milestone, but once a series field is set, None is invalid.521 create the milestone, but once a series field is set, None is invalid.
522 The choice for the series is redefined to ensure None is not included.522 The choice for the series is redefined to ensure None is not included.
523 """523 """
524 super(MilestoneEditView, self).setUpFields()524 super().setUpFields()
525 if self.context.product is None:525 if self.context.product is None:
526 # This is a distribution milestone.526 # This is a distribution milestone.
527 choice = Choice(527 choice = Choice(
@@ -538,7 +538,7 @@ class MilestoneEditView(MilestoneTagBase, LaunchpadEditFormView):
538 @action(_('Update'), name='update')538 @action(_('Update'), name='update')
539 def update_action(self, action, data):539 def update_action(self, action, data):
540 """Update the milestone."""540 """Update the milestone."""
541 tags = data.pop('tags') or u''541 tags = data.pop('tags') or ''
542 self.updateContextFromData(data)542 self.updateContextFromData(data)
543 self.context.setTags(tags.lower().split(), self.user)543 self.context.setTags(tags.lower().split(), self.user)
544 self.next_url = canonical_url(self.context)544 self.next_url = canonical_url(self.context)
@@ -611,17 +611,17 @@ class MilestoneTagView(
611 :param context: `IProjectGroupMilestoneTag`611 :param context: `IProjectGroupMilestoneTag`
612 :param request: `ILaunchpadRequest`.612 :param request: `ILaunchpadRequest`.
613 """613 """
614 super(MilestoneTagView, self).__init__(context, request)614 super().__init__(context, request)
615 self.context = self.milestone = context615 self.context = self.milestone = context
616 self.release = None616 self.release = None
617617
618 @property618 @property
619 def initial_values(self):619 def initial_values(self):
620 """Set the initial value of the search tags field."""620 """Set the initial value of the search tags field."""
621 return {'tags': u' '.join(self.context.tags)}621 return {'tags': ' '.join(self.context.tags)}
622622
623 @safe_action623 @safe_action
624 @action(u'Search Milestone Tags', name='search')624 @action('Search Milestone Tags', name='search')
625 def search_by_tags(self, action, data):625 def search_by_tags(self, action, data):
626 tags = data['tags'].split()626 tags = data['tags'].split()
627 milestone_tag = ProjectGroupMilestoneTag(self.context.target, tags)627 milestone_tag = ProjectGroupMilestoneTag(self.context.target, tags)
diff --git a/lib/lp/registry/browser/objectreassignment.py b/lib/lp/registry/browser/objectreassignment.py
index 79c0ddf..014f9a2 100644
--- a/lib/lp/registry/browser/objectreassignment.py
+++ b/lib/lp/registry/browser/objectreassignment.py
@@ -72,7 +72,7 @@ class ObjectReassignmentView(LaunchpadFormView):
72 page_title = label72 page_title = label
7373
74 def setUpFields(self):74 def setUpFields(self):
75 super(ObjectReassignmentView, self).setUpFields()75 super().setUpFields()
76 self.form_fields = FormFields(76 self.form_fields = FormFields(
77 self.form_fields, self.auto_create_team_field)77 self.form_fields, self.auto_create_team_field)
7878
diff --git a/lib/lp/registry/browser/ociproject.py b/lib/lp/registry/browser/ociproject.py
index 55f2d61..85a1c00 100644
--- a/lib/lp/registry/browser/ociproject.py
+++ b/lib/lp/registry/browser/ociproject.py
@@ -93,7 +93,7 @@ class OCIProjectURL:
93 if (policy == DistributionDefaultTraversalPolicy.OCI_PROJECT and93 if (policy == DistributionDefaultTraversalPolicy.OCI_PROJECT and
94 not self.context.distribution.redirect_default_traversal):94 not self.context.distribution.redirect_default_traversal):
95 return self.context.name95 return self.context.name
96 return u"+oci/%s" % self.context.name96 return "+oci/%s" % self.context.name
9797
9898
99def getPillarFieldName(pillar):99def getPillarFieldName(pillar):
@@ -114,7 +114,7 @@ class OCIProjectAddView(LaunchpadFormView):
114 if (not getFeatureFlag(OCI_PROJECT_ALLOW_CREATE) and not114 if (not getFeatureFlag(OCI_PROJECT_ALLOW_CREATE) and not
115 self.context.canAdministerOCIProjects(self.user)):115 self.context.canAdministerOCIProjects(self.user)):
116 raise OCIProjectCreateFeatureDisabled116 raise OCIProjectCreateFeatureDisabled
117 super(OCIProjectAddView, self).initialize()117 super().initialize()
118118
119 @action("Create OCI Project", name="create")119 @action("Create OCI Project", name="create")
120 def create_action(self, action, data):120 def create_action(self, action, data):
@@ -129,7 +129,7 @@ class OCIProjectAddView(LaunchpadFormView):
129 self.next_url = canonical_url(oci_project)129 self.next_url = canonical_url(oci_project)
130130
131 def validate(self, data):131 def validate(self, data):
132 super(OCIProjectAddView, self).validate(data)132 super().validate(data)
133 name = data.get('name', None)133 name = data.get('name', None)
134 oci_project_name = getUtility(134 oci_project_name = getUtility(
135 IOCIProjectNameSet).getOrCreateByName(name)135 IOCIProjectNameSet).getOrCreateByName(name)
@@ -289,7 +289,7 @@ class OCIProjectEditView(LaunchpadEditFormView):
289 pillar_key = getPillarFieldName(self.context.pillar)289 pillar_key = getPillarFieldName(self.context.pillar)
290 self.field_names = [pillar_key] + self.field_names290 self.field_names = [pillar_key] + self.field_names
291291
292 super(OCIProjectEditView, self).setUpFields()292 super().setUpFields()
293293
294 # Set the correct pillar field as mandatory294 # Set the correct pillar field as mandatory
295 pillar_field = self.form_fields.get(pillar_key).field295 pillar_field = self.form_fields.get(pillar_key).field
@@ -302,7 +302,7 @@ class OCIProjectEditView(LaunchpadEditFormView):
302 page_title = 'Edit'302 page_title = 'Edit'
303303
304 def validate(self, data):304 def validate(self, data):
305 super(OCIProjectEditView, self).validate(data)305 super().validate(data)
306 pillar_type_field = getPillarFieldName(self.context.pillar)306 pillar_type_field = getPillarFieldName(self.context.pillar)
307 pillar = data.get(pillar_type_field)307 pillar = data.get(pillar_type_field)
308 name = data.get('name')308 name = data.get('name')
diff --git a/lib/lp/registry/browser/peoplemerge.py b/lib/lp/registry/browser/peoplemerge.py
index eb15d67..f37f6da 100644
--- a/lib/lp/registry/browser/peoplemerge.py
+++ b/lib/lp/registry/browser/peoplemerge.py
@@ -123,7 +123,7 @@ class AdminMergeBaseView(ValidatingMergeView):
123 # only in certain circunstances, so don't include them in the list of123 # only in certain circunstances, so don't include them in the list of
124 # actions to be rendered.124 # actions to be rendered.
125 self.actions = [self.merge_action]125 self.actions = [self.merge_action]
126 return super(AdminMergeBaseView, self).render()126 return super().render()
127127
128 def setUpPeople(self, data):128 def setUpPeople(self, data):
129 """Store the people to be merged in instance variables.129 """Store the people to be merged in instance variables.
@@ -224,7 +224,7 @@ class AdminTeamMergeView(AdminMergeBaseView):
224 if len(self.errors) > 0:224 if len(self.errors) > 0:
225 return225 return
226226
227 super(AdminTeamMergeView, self).validate(data)227 super().validate(data)
228 dupe_team = data['dupe_person']228 dupe_team = data['dupe_person']
229 # We cannot merge the teams if there is a mailing list on the229 # We cannot merge the teams if there is a mailing list on the
230 # duplicate person, unless that mailing list is purged.230 # duplicate person, unless that mailing list is purged.
@@ -248,14 +248,14 @@ class AdminTeamMergeView(AdminMergeBaseView):
248 # merge.248 # merge.
249 self.should_confirm_member_deactivation = True249 self.should_confirm_member_deactivation = True
250 return250 return
251 super(AdminTeamMergeView, self).doMerge(data)251 super().doMerge(data)
252252
253 @action('Deactivate Members and Merge',253 @action('Deactivate Members and Merge',
254 name='deactivate_members_and_merge')254 name='deactivate_members_and_merge')
255 def deactivate_members_and_merge_action(self, action, data):255 def deactivate_members_and_merge_action(self, action, data):
256 """Deactivate all members of the team to be merged and merge them."""256 """Deactivate all members of the team to be merged and merge them."""
257 self.setUpPeople(data)257 self.setUpPeople(data)
258 super(AdminTeamMergeView, self).doMerge(data)258 super().doMerge(data)
259259
260260
261class DeleteTeamView(AdminTeamMergeView):261class DeleteTeamView(AdminTeamMergeView):
@@ -270,7 +270,7 @@ class DeleteTeamView(AdminTeamMergeView):
270 return 'Delete %s' % self.context.displayname270 return 'Delete %s' % self.context.displayname
271271
272 def __init__(self, context, request):272 def __init__(self, context, request):
273 super(DeleteTeamView, self).__init__(context, request)273 super().__init__(context, request)
274 if ('field.dupe_person' in self.request.form):274 if ('field.dupe_person' in self.request.form):
275 # These fields have fixed values and are managed by this method.275 # These fields have fixed values and are managed by this method.
276 # The user has crafted a request to gain ownership of the dupe276 # The user has crafted a request to gain ownership of the dupe
@@ -311,9 +311,8 @@ class DeleteTeamView(AdminTeamMergeView):
311311
312 @action('Delete', name='delete', condition=canDelete)312 @action('Delete', name='delete', condition=canDelete)
313 def merge_action(self, action, data):313 def merge_action(self, action, data):
314 base = super(DeleteTeamView, self)
315 self.delete = True314 self.delete = True
316 base.deactivate_members_and_merge_action.success(data)315 super().deactivate_members_and_merge_action.success(data)
317316
318317
319class FinishedPeopleMergeRequestView(LaunchpadView):318class FinishedPeopleMergeRequestView(LaunchpadView):
@@ -361,8 +360,7 @@ class RequestPeopleMergeMultipleEmailsView(LaunchpadView):
361 page_title = label360 page_title = label
362361
363 def __init__(self, context, request):362 def __init__(self, context, request):
364 super(RequestPeopleMergeMultipleEmailsView, self).__init__(363 super().__init__(context, request)
365 context, request)
366 self.form_processed = False364 self.form_processed = False
367 self.dupe = None365 self.dupe = None
368 self.notified_addresses = []366 self.notified_addresses = []
diff --git a/lib/lp/registry/browser/person.py b/lib/lp/registry/browser/person.py
index 7cf2fcb..ccd09c7 100644
--- a/lib/lp/registry/browser/person.py
+++ b/lib/lp/registry/browser/person.py
@@ -65,7 +65,6 @@ from lazr.restful.interfaces import IWebServiceClientRequest
65from lazr.restful.utils import smartquote65from lazr.restful.utils import smartquote
66from lazr.uri import URI66from lazr.uri import URI
67import pytz67import pytz
68import six
69from six.moves.urllib.parse import (68from six.moves.urllib.parse import (
70 quote,69 quote,
71 urlencode,70 urlencode,
@@ -470,7 +469,7 @@ class BranchTraversalMixin:
470 branch = getUtility(IBranchNamespaceSet).traverse(469 branch = getUtility(IBranchNamespaceSet).traverse(
471 self._getSegments(pillar_name))470 self._getSegments(pillar_name))
472 except (NotFoundError, InvalidNamespace):471 except (NotFoundError, InvalidNamespace):
473 return super(BranchTraversalMixin, self).traverse(pillar_name)472 return super().traverse(pillar_name)
474473
475 # Normally, populating the launch bag is done by the traversal474 # Normally, populating the launch bag is done by the traversal
476 # mechanism. However, here we short-circuit that mechanism by475 # mechanism. However, here we short-circuit that mechanism by
@@ -905,8 +904,8 @@ class PersonOverviewMenu(ApplicationMenu, PersonMenuMixin, HasRecipesMenuMixin,
905 target = '+karma'904 target = '+karma'
906 text = 'Show karma summary'905 text = 'Show karma summary'
907 summary = (906 summary = (
908 u'%s\N{right single quotation mark}s activities '907 '%s\N{right single quotation mark}s activities '
909 u'in Launchpad' % self.context.displayname)908 'in Launchpad' % self.context.displayname)
910 return Link(target, text, summary, icon='info')909 return Link(target, text, summary, icon='info')
911910
912 def memberships(self):911 def memberships(self):
@@ -1034,7 +1033,7 @@ class PeopleSearchView(LaunchpadView):
1034 page_title = 'People and teams in Launchpad'1033 page_title = 'People and teams in Launchpad'
10351034
1036 def __init__(self, context, request):1035 def __init__(self, context, request):
1037 super(PeopleSearchView, self).__init__(context, request)1036 super().__init__(context, request)
1038 self.results = []1037 self.results = []
10391038
1040 @property1039 @property
@@ -1092,7 +1091,7 @@ class PersonDeactivateAccountView(LaunchpadFormView):
1092 getUtility(IPersonDeactivateJobSource).create(self.context)1091 getUtility(IPersonDeactivateJobSource).create(self.context)
1093 logoutPerson(self.request)1092 logoutPerson(self.request)
1094 self.request.response.addInfoNotification(1093 self.request.response.addInfoNotification(
1095 _(u'Your account has been deactivated.'))1094 _('Your account has been deactivated.'))
1096 self.next_url = self.request.getApplicationURL()1095 self.next_url = self.request.getApplicationURL()
10971096
10981097
@@ -1237,7 +1236,7 @@ class PersonRenameFormMixin(LaunchpadEditFormView):
1237 if reason:1236 if reason:
1238 # This makes the field's widget display (i.e. read) only.1237 # This makes the field's widget display (i.e. read) only.
1239 self.form_fields['name'].for_display = True1238 self.form_fields['name'].for_display = True
1240 super(PersonRenameFormMixin, self).setUpWidgets()1239 super().setUpWidgets()
1241 if reason:1240 if reason:
1242 self.widgets['name'].hint = reason1241 self.widgets['name'].hint = reason
12431242
@@ -1319,7 +1318,7 @@ class PersonAccountAdministerView(LaunchpadFormView):
13191318
1320 def __init__(self, context, request):1319 def __init__(self, context, request):
1321 """See `LaunchpadEditFormView`."""1320 """See `LaunchpadEditFormView`."""
1322 super(PersonAccountAdministerView, self).__init__(context, request)1321 super().__init__(context, request)
1323 # Only the IPerson can be traversed to, so it provides the IAccount.1322 # Only the IPerson can be traversed to, so it provides the IAccount.
1324 # It also means that permissions are checked on IAccount, not IPerson.1323 # It also means that permissions are checked on IAccount, not IPerson.
1325 self.person = self.context1324 self.person = self.context
@@ -1376,18 +1375,18 @@ class PersonAccountAdministerView(LaunchpadFormView):
1376 # is sent to the user.1375 # is sent to the user.
1377 self.person.setPreferredEmail(None)1376 self.person.setPreferredEmail(None)
1378 self.request.response.addInfoNotification(1377 self.request.response.addInfoNotification(
1379 u'The account "%s" has been suspended.'1378 'The account "%s" has been suspended.'
1380 % self.context.displayname)1379 % self.context.displayname)
1381 elif data['status'] == AccountStatus.DEACTIVATED:1380 elif data['status'] == AccountStatus.DEACTIVATED:
1382 self.request.response.addInfoNotification(1381 self.request.response.addInfoNotification(
1383 u'The account "%s" is now deactivated. The user can log in '1382 'The account "%s" is now deactivated. The user can log in '
1384 u'to reactivate it.' % self.context.displayname)1383 'to reactivate it.' % self.context.displayname)
1385 elif data['status'] == AccountStatus.DECEASED:1384 elif data['status'] == AccountStatus.DECEASED:
1386 # Deliberately leave the email address in place so that it can't1385 # Deliberately leave the email address in place so that it can't
1387 # easily be claimed by somebody else.1386 # easily be claimed by somebody else.
1388 self.request.response.addInfoNotification(1387 self.request.response.addInfoNotification(
1389 u'The account "%s" has been marked as having belonged to a '1388 'The account "%s" has been marked as having belonged to a '
1390 u'deceased user.' % self.context.displayname)1389 'deceased user.' % self.context.displayname)
1391 self.context.setStatus(data['status'], self.user, data['comment'])1390 self.context.setStatus(data['status'], self.user, data['comment'])
13921391
13931392
@@ -1464,7 +1463,7 @@ class PersonLanguagesView(LaunchpadFormView):
1464 new_languages = []1463 new_languages = []
14651464
1466 for key in all_languages.keys():1465 for key in all_languages.keys():
1467 if self.request.get(key, None) == u'on':1466 if self.request.get(key, None) == 'on':
1468 new_languages.append(all_languages[key])1467 new_languages.append(all_languages[key])
14691468
1470 if self.is_current_user:1469 if self.is_current_user:
@@ -2128,7 +2127,7 @@ class PersonIndexView(XRDSContentNegotiationMixin, PersonView,
2128 "../../services/openid/templates/person-xrds.pt")2127 "../../services/openid/templates/person-xrds.pt")
21292128
2130 def initialize(self):2129 def initialize(self):
2131 super(PersonIndexView, self).initialize()2130 super().initialize()
2132 if self.context.isMergePending():2131 if self.context.isMergePending():
2133 if self.context.is_team:2132 if self.context.is_team:
2134 merge_action = 'merged or deleted'2133 merge_action = 'merged or deleted'
@@ -2225,7 +2224,7 @@ class PersonCodeOfConductEditView(LaunchpadView):
2225 for sig_id in sig_ids:2224 for sig_id in sig_ids:
2226 sig_id = int(sig_id)2225 sig_id = int(sig_id)
2227 # Deactivating signature.2226 # Deactivating signature.
2228 comment = u'Deactivated by Owner'2227 comment = 'Deactivated by Owner'
2229 sCoC_util.modifySignature(sig_id, self.user, comment, False)2228 sCoC_util.modifySignature(sig_id, self.user, comment, False)
22302229
22312230
@@ -2285,7 +2284,7 @@ class PersonEditJabberIDsView(LaunchpadFormView):
2285 field_names = ['jabberid']2284 field_names = ['jabberid']
22862285
2287 def setUpFields(self):2286 def setUpFields(self):
2288 super(PersonEditJabberIDsView, self).setUpFields()2287 super().setUpFields()
2289 if not self.context.jabberids.is_empty():2288 if not self.context.jabberids.is_empty():
2290 # Make the jabberid entry optional on the edit page if one or more2289 # Make the jabberid entry optional on the edit page if one or more
2291 # ids already exist, which allows the removal of ids without2290 # ids already exist, which allows the removal of ids without
@@ -2422,7 +2421,7 @@ class PersonGPGView(LaunchpadView):
24222421
2423 def initialize(self):2422 def initialize(self):
2424 require_fresh_login(self.request, self.context, '+editpgpkeys')2423 require_fresh_login(self.request, self.context, '+editpgpkeys')
2425 super(PersonGPGView, self).initialize()2424 super().initialize()
24262425
2427 @property2426 @property
2428 def cancel_url(self):2427 def cancel_url(self):
@@ -2725,7 +2724,7 @@ class PersonEditEmailsView(LaunchpadFormView):
2725 # +editemails is not available on teams.2724 # +editemails is not available on teams.
2726 name = self.request['PATH_INFO'].split('/')[-1]2725 name = self.request['PATH_INFO'].split('/')[-1]
2727 raise NotFound(self, name, request=self.request)2726 raise NotFound(self, name, request=self.request)
2728 super(PersonEditEmailsView, self).initialize()2727 super().initialize()
27292728
2730 def setUpFields(self):2729 def setUpFields(self):
2731 """Set up fields for this view.2730 """Set up fields for this view.
@@ -2734,11 +2733,11 @@ class PersonEditEmailsView(LaunchpadFormView):
2734 vocabularies for the lists of validated and unvalidated email2733 vocabularies for the lists of validated and unvalidated email
2735 addresses.2734 addresses.
2736 """2735 """
2737 super(PersonEditEmailsView, self).setUpFields()2736 super().setUpFields()
2738 self.form_fields = (self._validated_emails_field() +2737 self.form_fields = (self._validated_emails_field() +
2739 self._unvalidated_emails_field() +2738 self._unvalidated_emails_field() +
2740 FormFields(TextLine(__name__='newemail',2739 FormFields(TextLine(__name__='newemail',
2741 title=u'Add a new address')))2740 title='Add a new address')))
27422741
2743 @property2742 @property
2744 def initial_values(self):2743 def initial_values(self):
@@ -2786,7 +2785,7 @@ class PersonEditEmailsView(LaunchpadFormView):
2786 """2785 """
2787 terms = []2786 terms = []
2788 for term in self.unvalidated_addresses:2787 for term in self.unvalidated_addresses:
2789 if isinstance(term, six.text_type):2788 if isinstance(term, str):
2790 term = SimpleTerm(term)2789 term = SimpleTerm(term)
2791 else:2790 else:
2792 term = SimpleTerm(term, term.email)2791 term = SimpleTerm(term, term.email)
@@ -2827,7 +2826,7 @@ class PersonEditEmailsView(LaunchpadFormView):
2827 "self.context.id(%s,%d) (%s)"2826 "self.context.id(%s,%d) (%s)"
2828 % (person.name, person.id, self.context.name, self.context.id,2827 % (person.name, person.id, self.context.name, self.context.id,
2829 email.email))2828 email.email))
2830 elif isinstance(email, six.text_type):2829 elif isinstance(email, str):
2831 tokenset = getUtility(ILoginTokenSet)2830 tokenset = getUtility(ILoginTokenSet)
2832 email = tokenset.searchByEmailRequesterAndType(2831 email = tokenset.searchByEmailRequesterAndType(
2833 email, self.context, LoginTokenType.VALIDATEEMAIL)2832 email, self.context, LoginTokenType.VALIDATEEMAIL)
@@ -2953,7 +2952,7 @@ class PersonEditEmailsView(LaunchpadFormView):
2953 if IEmailAddress.providedBy(emailaddress):2952 if IEmailAddress.providedBy(emailaddress):
2954 emailaddress.destroySelf()2953 emailaddress.destroySelf()
2955 email = emailaddress.email2954 email = emailaddress.email
2956 elif isinstance(emailaddress, six.text_type):2955 elif isinstance(emailaddress, str):
2957 logintokenset = getUtility(ILoginTokenSet)2956 logintokenset = getUtility(ILoginTokenSet)
2958 logintokenset.deleteByEmailRequesterAndType(2957 logintokenset.deleteByEmailRequesterAndType(
2959 emailaddress, self.context, LoginTokenType.VALIDATEEMAIL)2958 emailaddress, self.context, LoginTokenType.VALIDATEEMAIL)
@@ -3049,7 +3048,7 @@ class PersonEditMailingListsView(LaunchpadFormView):
3049 # +editmailinglists is not available on teams.3048 # +editmailinglists is not available on teams.
3050 name = self.request['PATH_INFO'].split('/')[-1]3049 name = self.request['PATH_INFO'].split('/')[-1]
3051 raise NotFound(self, name, request=self.request)3050 raise NotFound(self, name, request=self.request)
3052 super(PersonEditMailingListsView, self).initialize()3051 super().initialize()
30533052
3054 def setUpFields(self):3053 def setUpFields(self):
3055 """Set up fields for this view.3054 """Set up fields for this view.
@@ -3058,7 +3057,7 @@ class PersonEditMailingListsView(LaunchpadFormView):
3058 vocabularies for the lists of validated and unvalidated email3057 vocabularies for the lists of validated and unvalidated email
3059 addresses.3058 addresses.
3060 """3059 """
3061 super(PersonEditMailingListsView, self).setUpFields()3060 super().setUpFields()
3062 self.form_fields = (self._mailing_list_fields()3061 self.form_fields = (self._mailing_list_fields()
3063 + self._autosubscribe_policy_fields())3062 + self._autosubscribe_policy_fields())
30643063
@@ -3081,7 +3080,7 @@ class PersonEditMailingListsView(LaunchpadFormView):
30813080
3082 def setUpWidgets(self, context=None):3081 def setUpWidgets(self, context=None):
3083 """See `LaunchpadFormView`."""3082 """See `LaunchpadFormView`."""
3084 super(PersonEditMailingListsView, self).setUpWidgets(context)3083 super().setUpWidgets(context)
3085 widget = self.widgets['mailing_list_auto_subscribe_policy']3084 widget = self.widgets['mailing_list_auto_subscribe_policy']
3086 widget.display_label = False3085 widget.display_label = False
30873086
@@ -3679,7 +3678,7 @@ class PersonOCIRegistryCredentialsView(LaunchpadView):
3679 def initialize(self):3678 def initialize(self):
3680 if not user_can_edit_credentials_for_owner(self.context, self.user):3679 if not user_can_edit_credentials_for_owner(self.context, self.user):
3681 raise Unauthorized3680 raise Unauthorized
3682 super(PersonOCIRegistryCredentialsView, self).initialize()3681 super().initialize()
36833682
3684 @property3683 @property
3685 def label(self):3684 def label(self):
@@ -3712,7 +3711,7 @@ class PersonEditOCIRegistryCredentialsView(LaunchpadFormView):
3712 def initialize(self):3711 def initialize(self):
3713 if not user_can_edit_credentials_for_owner(self.context, self.user):3712 if not user_can_edit_credentials_for_owner(self.context, self.user):
3714 raise Unauthorized3713 raise Unauthorized
3715 super(PersonEditOCIRegistryCredentialsView, self).initialize()3714 super().initialize()
37163715
3717 def _getFieldName(self, name, credentials_id):3716 def _getFieldName(self, name, credentials_id):
3718 """Get the combined field name for an `OCIRegistryCredentials` ID.3717 """Get the combined field name for an `OCIRegistryCredentials` ID.
@@ -3764,25 +3763,25 @@ class PersonEditOCIRegistryCredentialsView(LaunchpadFormView):
37643763
3765 def getAddFieldsRow(self):3764 def getAddFieldsRow(self):
3766 add_url = TextLine(3765 add_url = TextLine(
3767 __name__=u'add_url',3766 __name__='add_url',
3768 required=False, readonly=False)3767 required=False, readonly=False)
3769 add_region = TextLine(3768 add_region = TextLine(
3770 __name__=u'add_region',3769 __name__='add_region',
3771 required=False, readonly=False)3770 required=False, readonly=False)
3772 add_owner = Choice(3771 add_owner = Choice(
3773 __name__=u'add_owner',3772 __name__='add_owner',
3774 vocabulary=(3773 vocabulary=(
3775 'AllUserTeamsParticipationPlusSelfSimpleDisplay'),3774 'AllUserTeamsParticipationPlusSelfSimpleDisplay'),
3776 default=self.default_owner,3775 default=self.default_owner,
3777 required=False, readonly=False)3776 required=False, readonly=False)
3778 add_username = TextLine(3777 add_username = TextLine(
3779 __name__=u'add_username',3778 __name__='add_username',
3780 required=False, readonly=False)3779 required=False, readonly=False)
3781 add_password = Password(3780 add_password = Password(
3782 __name__=u'add_password',3781 __name__='add_password',
3783 required=False, readonly=False)3782 required=False, readonly=False)
3784 add_confirm_password = Password(3783 add_confirm_password = Password(
3785 __name__=u'add_confirm_password',3784 __name__='add_confirm_password',
3786 required=False, readonly=False)3785 required=False, readonly=False)
37873786
3788 return (3787 return (
@@ -3819,8 +3818,7 @@ class PersonEditOCIRegistryCredentialsView(LaunchpadFormView):
3819 self.form_fields += FormFields(*add_fields)3818 self.form_fields += FormFields(*add_fields)
38203819
3821 def setUpWidgets(self, context=None):3820 def setUpWidgets(self, context=None):
3822 super(PersonEditOCIRegistryCredentialsView, self).setUpWidgets(3821 super().setUpWidgets(context=context)
3823 context=context)
3824 for widget in self.widgets:3822 for widget in self.widgets:
3825 widget.display_label = False3823 widget.display_label = False
3826 widget.hint = None3824 widget.hint = None
@@ -4249,19 +4247,16 @@ class ContactViaWebNotificationRecipientSet:
42494247
4250 def getEmails(self):4248 def getEmails(self):
4251 """See `INotificationRecipientSet`."""4249 """See `INotificationRecipientSet`."""
4252 for email in sorted(self._all_recipients.keys()):4250 yield from sorted(self._all_recipients.keys())
4253 yield email
42544251
4255 def getRecipients(self):4252 def getRecipients(self):
4256 """See `INotificationRecipientSet`."""4253 """See `INotificationRecipientSet`."""
4257 for recipient in sorted(4254 yield from sorted(
4258 self._all_recipients.values(), key=attrgetter('displayname')):4255 self._all_recipients.values(), key=attrgetter('displayname'))
4259 yield recipient
42604256
4261 def getRecipientPersons(self):4257 def getRecipientPersons(self):
4262 """See `INotificationRecipientSet`."""4258 """See `INotificationRecipientSet`."""
4263 for email, person in self._all_recipients.items():4259 yield from self._all_recipients.items()
4264 yield (email, person)
42654260
4266 def __iter__(self):4261 def __iter__(self):
4267 """See `INotificationRecipientSet`."""4262 """See `INotificationRecipientSet`."""
@@ -4351,7 +4346,7 @@ class EmailToPersonView(LaunchpadFormView):
4351 a vocabulary of the user's preferred (first) and validated4346 a vocabulary of the user's preferred (first) and validated
4352 (subsequent) email addresses.4347 (subsequent) email addresses.
4353 """4348 """
4354 super(EmailToPersonView, self).setUpFields()4349 super().setUpFields()
4355 usable_addresses = [self.user.preferredemail]4350 usable_addresses = [self.user.preferredemail]
4356 usable_addresses.extend(self.user.validatedemails)4351 usable_addresses.extend(self.user.validatedemails)
4357 terms = [SimpleTerm(email, email.email) for email in usable_addresses]4352 terms = [SimpleTerm(email, email.email) for email in usable_addresses]
diff --git a/lib/lp/registry/browser/pillar.py b/lib/lp/registry/browser/pillar.py
index 4c09eb2..3f5c29d 100644
--- a/lib/lp/registry/browser/pillar.py
+++ b/lib/lp/registry/browser/pillar.py
@@ -164,7 +164,7 @@ class PillarInvolvementView(LaunchpadView):
164 visible_disabled_link_names = []164 visible_disabled_link_names = []
165165
166 def __init__(self, context, request):166 def __init__(self, context, request):
167 super(PillarInvolvementView, self).__init__(context, request)167 super().__init__(context, request)
168 self.official_malone = False168 self.official_malone = False
169 self.answers_usage = ServiceUsage.UNKNOWN169 self.answers_usage = ServiceUsage.UNKNOWN
170 self.blueprints_usage = ServiceUsage.UNKNOWN170 self.blueprints_usage = ServiceUsage.UNKNOWN
@@ -278,7 +278,7 @@ class PillarViewMixin():
278 def initialize(self):278 def initialize(self):
279 # Insert close team membership policy data into the json cache.279 # Insert close team membership policy data into the json cache.
280 # This data is used for the maintainer and driver pickers.280 # This data is used for the maintainer and driver pickers.
281 super(PillarViewMixin, self).initialize()281 super().initialize()
282 cache = IJSONRequestCache(self.request)282 cache = IJSONRequestCache(self.request)
283 policy_items = [(item.name, item) for item in EXCLUSIVE_TEAM_POLICY]283 policy_items = [(item.name, item) for item in EXCLUSIVE_TEAM_POLICY]
284 team_membership_policy_data = vocabulary_to_choice_edit_items(284 team_membership_policy_data = vocabulary_to_choice_edit_items(
@@ -365,7 +365,7 @@ class PillarSharingView(LaunchpadView):
365 return self._getSharingService().getPillarGrantees(self.context)365 return self._getSharingService().getPillarGrantees(self.context)
366366
367 def initialize(self):367 def initialize(self):
368 super(PillarSharingView, self).initialize()368 super().initialize()
369 cache = IJSONRequestCache(self.request)369 cache = IJSONRequestCache(self.request)
370 cache.objects['information_types'] = self.information_types370 cache.objects['information_types'] = self.information_types
371 cache.objects['sharing_permissions'] = self.sharing_permissions371 cache.objects['sharing_permissions'] = self.sharing_permissions
diff --git a/lib/lp/registry/browser/poll.py b/lib/lp/registry/browser/poll.py
index eaba0c7..66049fe 100644
--- a/lib/lp/registry/browser/poll.py
+++ b/lib/lp/registry/browser/poll.py
@@ -227,7 +227,7 @@ class PollView(BasePollView):
227 """A view class to display the results of a poll."""227 """A view class to display the results of a poll."""
228228
229 def initialize(self):229 def initialize(self):
230 super(PollView, self).initialize()230 super().initialize()
231 request = self.request231 request = self.request
232 if (self.userCanVote() and self.context.isOpen() and232 if (self.userCanVote() and self.context.isOpen() and
233 self.context.getActiveOptions()):233 self.context.getActiveOptions()):
@@ -281,7 +281,7 @@ class PollVoteView(BasePollView):
281281
282 def initialize(self):282 def initialize(self):
283 """Process the form, if it was submitted."""283 """Process the form, if it was submitted."""
284 super(PollVoteView, self).initialize()284 super().initialize()
285 if not self.isSecret() and self.userVoted():285 if not self.isSecret() and self.userVoted():
286 # For non-secret polls, the user's vote is always displayed286 # For non-secret polls, the user's vote is always displayed
287 self.setUpTokenAndVotesForNonSecretPolls()287 self.setUpTokenAndVotesForNonSecretPolls()
diff --git a/lib/lp/registry/browser/product.py b/lib/lp/registry/browser/product.py
index 3f58926..faea1f8 100644
--- a/lib/lp/registry/browser/product.py
+++ b/lib/lp/registry/browser/product.py
@@ -517,7 +517,7 @@ class ProductEditLinksMixin(StructuralSubscriptionMenuMixin):
517 def search_oci_project(self):517 def search_oci_project(self):
518 product = self.context.context518 product = self.context.context
519 oci_projects = getUtility(IOCIProjectSet).findByPillarAndName(519 oci_projects = getUtility(IOCIProjectSet).findByPillarAndName(
520 product, u'')520 product, '')
521 text = 'Search for OCI project'521 text = 'Search for OCI project'
522 link = Link('+search-oci-project', text, icon='info')522 link = Link('+search-oci-project', text, icon='info')
523 link.enabled = not oci_projects.is_empty()523 link.enabled = not oci_projects.is_empty()
@@ -807,7 +807,7 @@ class SeriesWithReleases(DecoratedSeries):
807 releases = None807 releases = None
808808
809 def __init__(self, series, parent):809 def __init__(self, series, parent):
810 super(SeriesWithReleases, self).__init__(series)810 super().__init__(series)
811 self.parent = parent811 self.parent = parent
812 self.releases = []812 self.releases = []
813813
@@ -987,7 +987,7 @@ class ProductView(PillarViewMixin, HasAnnouncementsView, SortSeriesMixin,
987 self.form = request.form_ng987 self.form = request.form_ng
988988
989 def initialize(self):989 def initialize(self):
990 super(ProductView, self).initialize()990 super().initialize()
991 self.status_message = None991 self.status_message = None
992 product = self.context992 product = self.context
993 programming_lang = IProduct['programminglang']993 programming_lang = IProduct['programminglang']
@@ -1370,7 +1370,7 @@ class ProductConfigureBase(ReturnToReferrerMixin, LaunchpadEditFormView):
1370 usage_fieldname = None1370 usage_fieldname = None
13711371
1372 def setUpFields(self):1372 def setUpFields(self):
1373 super(ProductConfigureBase, self).setUpFields()1373 super().setUpFields()
1374 if self.usage_fieldname is not None:1374 if self.usage_fieldname is not None:
1375 # The usage fields are shared among pillars. But when referring1375 # The usage fields are shared among pillars. But when referring
1376 # to an individual object in Launchpad it is better to call it by1376 # to an individual object in Launchpad it is better to call it by
@@ -1474,7 +1474,7 @@ class ProductEditView(ProductLicenseMixin, LaunchpadEditFormView):
1474 # when an action is invoked.1474 # when an action is invoked.
1475 cache = IJSONRequestCache(self.request)1475 cache = IJSONRequestCache(self.request)
1476 json_dump_information_types(cache, PILLAR_INFORMATION_TYPES)1476 json_dump_information_types(cache, PILLAR_INFORMATION_TYPES)
1477 super(ProductEditView, self).initialize()1477 super().initialize()
14781478
1479 def validate(self, data):1479 def validate(self, data):
1480 """Validate 'licenses' and 'license_info'.1480 """Validate 'licenses' and 'license_info'.
@@ -1485,7 +1485,7 @@ class ProductEditView(ProductLicenseMixin, LaunchpadEditFormView):
1485 'license_info' must not be empty if "Other/Proprietary"1485 'license_info' must not be empty if "Other/Proprietary"
1486 or "Other/Open Source" is checked.1486 or "Other/Open Source" is checked.
1487 """1487 """
1488 super(ProductEditView, self).validate(data)1488 super().validate(data)
1489 information_type = data.get('information_type')1489 information_type = data.get('information_type')
1490 if information_type:1490 if information_type:
1491 errors = [1491 errors = [
@@ -1502,7 +1502,7 @@ class ProductEditView(ProductLicenseMixin, LaunchpadEditFormView):
1502 # LicenseWidget instead of the enclosing form.1502 # LicenseWidget instead of the enclosing form.
1503 if field_name == 'license_info':1503 if field_name == 'license_info':
1504 return False1504 return False
1505 return super(ProductEditView, self).showOptionalMarker(field_name)1505 return super().showOptionalMarker(field_name)
15061506
1507 @action("Change", name='change')1507 @action("Change", name='change')
1508 def change_action(self, action, data):1508 def change_action(self, action, data):
@@ -1550,7 +1550,7 @@ class ProductAdminView(ProductEditView, ProductValidationMixin):
1550 if not admin:1550 if not admin:
1551 self.field_names.remove('owner')1551 self.field_names.remove('owner')
1552 self.field_names.remove('autoupdate')1552 self.field_names.remove('autoupdate')
1553 super(ProductAdminView, self).setUpFields()1553 super().setUpFields()
1554 self.form_fields = self._createAliasesField() + self.form_fields1554 self.form_fields = self._createAliasesField() + self.form_fields
1555 if admin:1555 if admin:
1556 self.form_fields = (1556 self.form_fields = (
@@ -1590,7 +1590,7 @@ class ProductAdminView(ProductEditView, ProductValidationMixin):
15901590
1591 def validate(self, data):1591 def validate(self, data):
1592 """See `LaunchpadFormView`."""1592 """See `LaunchpadFormView`."""
1593 super(ProductAdminView, self).validate(data)1593 super().validate(data)
1594 self.validate_deactivation(data)1594 self.validate_deactivation(data)
15951595
1596 @property1596 @property
@@ -1618,7 +1618,7 @@ class ProductReviewLicenseView(ReturnToReferrerMixin, ProductEditView,
1618 def validate(self, data):1618 def validate(self, data):
1619 """See `LaunchpadFormView`."""1619 """See `LaunchpadFormView`."""
16201620
1621 super(ProductReviewLicenseView, self).validate(data)1621 super().validate(data)
1622 # A project can only be approved if it has OTHER_OPEN_SOURCE as one of1622 # A project can only be approved if it has OTHER_OPEN_SOURCE as one of
1623 # its licenses and not OTHER_PROPRIETARY.1623 # its licenses and not OTHER_PROPRIETARY.
1624 licenses = self.context.licenses1624 licenses = self.context.licenses
@@ -1848,11 +1848,11 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView,
1848 """1848 """
1849 if self.errors_in_action:1849 if self.errors_in_action:
1850 return None1850 return None
1851 return super(ProductSetBranchView, self).next_url1851 return super().next_url
18521852
1853 def setUpFields(self):1853 def setUpFields(self):
1854 """See `LaunchpadFormView`."""1854 """See `LaunchpadFormView`."""
1855 super(ProductSetBranchView, self).setUpFields()1855 super().setUpFields()
1856 if self.is_series:1856 if self.is_series:
1857 self.form_fields = self.form_fields.omit(1857 self.form_fields = self.form_fields.omit(
1858 'default_vcs', 'git_repository_location',1858 'default_vcs', 'git_repository_location',
@@ -1861,7 +1861,7 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView,
18611861
1862 def setUpWidgets(self):1862 def setUpWidgets(self):
1863 """See `LaunchpadFormView`."""1863 """See `LaunchpadFormView`."""
1864 super(ProductSetBranchView, self).setUpWidgets()1864 super().setUpWidgets()
1865 widget = self.widgets['rcs_type']1865 widget = self.widgets['rcs_type']
1866 vocab = widget.vocabulary1866 vocab = widget.vocabulary
1867 current_value = widget._getFormValue()1867 current_value = widget._getFormValue()
@@ -1878,9 +1878,9 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView,
1878 widget = self.widgets['branch_type']1878 widget = self.widgets['branch_type']
1879 current_value = widget._getFormValue()1879 current_value = widget._getFormValue()
1880 vocab = widget.vocabulary1880 vocab = widget.vocabulary
1881 self.branch_type_link, self.branch_type_import = [1881 self.branch_type_link, self.branch_type_import = (
1882 render_radio_widget_part(widget, value, current_value)1882 render_radio_widget_part(widget, value, current_value)
1883 for value in (LINK_LP, IMPORT_EXTERNAL)]1883 for value in (LINK_LP, IMPORT_EXTERNAL))
18841884
1885 if not self.is_series:1885 if not self.is_series:
1886 widget = self.widgets['default_vcs']1886 widget = self.widgets['default_vcs']
@@ -1894,9 +1894,9 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView,
1894 widget = self.widgets['git_repository_type']1894 widget = self.widgets['git_repository_type']
1895 current_value = widget._getFormValue()1895 current_value = widget._getFormValue()
1896 vocab = widget.vocabulary1896 vocab = widget.vocabulary
1897 self.git_repository_type_link, self.git_repository_type_import = [1897 self.git_repository_type_link, self.git_repository_type_import = (
1898 render_radio_widget_part(widget, value, current_value)1898 render_radio_widget_part(widget, value, current_value)
1899 for value in (LINK_LP, IMPORT_EXTERNAL)]1899 for value in (LINK_LP, IMPORT_EXTERNAL))
19001900
1901 def _validateLinkLpBzr(self, data):1901 def _validateLinkLpBzr(self, data):
1902 """Validate data for link-lp bzr case."""1902 """Validate data for link-lp bzr case."""
@@ -2005,7 +2005,7 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView,
2005 """See `LaunchpadFormView`."""2005 """See `LaunchpadFormView`."""
2006 names = [2006 names = [
2007 'branch_type', 'rcs_type', 'default_vcs', 'git_repository_type']2007 'branch_type', 'rcs_type', 'default_vcs', 'git_repository_type']
2008 super(ProductSetBranchView, self).validate_widgets(data, names)2008 super().validate_widgets(data, names)
20092009
2010 if not self.is_series:2010 if not self.is_series:
2011 git_repository_type = data.get('git_repository_type')2011 git_repository_type = data.get('git_repository_type')
@@ -2040,7 +2040,7 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView,
2040 raise AssertionError("Unknown branch type %s" % branch_type)2040 raise AssertionError("Unknown branch type %s" % branch_type)
20412041
2042 # Perform full validation now.2042 # Perform full validation now.
2043 super(ProductSetBranchView, self).validate_widgets(data)2043 super().validate_widgets(data)
20442044
2045 def validate(self, data):2045 def validate(self, data):
2046 """See `LaunchpadFormView`."""2046 """See `LaunchpadFormView`."""
@@ -2345,12 +2345,12 @@ class ProjectAddStepOne(StepView):
23452345
2346 def setUpFields(self):2346 def setUpFields(self):
2347 """See `LaunchpadFormView`."""2347 """See `LaunchpadFormView`."""
2348 super(ProjectAddStepOne, self).setUpFields()2348 super().setUpFields()
2349 self.form_fields = (self.form_fields + create_source_package_fields())2349 self.form_fields = (self.form_fields + create_source_package_fields())
23502350
2351 def setUpWidgets(self):2351 def setUpWidgets(self):
2352 """See `LaunchpadFormView`."""2352 """See `LaunchpadFormView`."""
2353 super(ProjectAddStepOne, self).setUpWidgets()2353 super().setUpWidgets()
2354 self.widgets['source_package_name'].visible = False2354 self.widgets['source_package_name'].visible = False
2355 self.widgets['distroseries'].visible = False2355 self.widgets['distroseries'].visible = False
23562356
@@ -2425,14 +2425,14 @@ class ProjectAddStepTwo(StepView, ProductLicenseMixin, ReturnToReferrerMixin):
2425 # when an action is invoked.2425 # when an action is invoked.
2426 cache = IJSONRequestCache(self.request)2426 cache = IJSONRequestCache(self.request)
2427 json_dump_information_types(cache, PILLAR_INFORMATION_TYPES)2427 json_dump_information_types(cache, PILLAR_INFORMATION_TYPES)
2428 super(ProjectAddStepTwo, self).initialize()2428 super().initialize()
24292429
2430 @property2430 @property
2431 def main_action_label(self):2431 def main_action_label(self):
2432 if self.source_package_name is None:2432 if self.source_package_name is None:
2433 return u'Complete Registration'2433 return 'Complete Registration'
2434 else:2434 else:
2435 return u'Complete registration and link to %s package' % (2435 return 'Complete registration and link to %s package' % (
2436 self.source_package_name.name)2436 self.source_package_name.name)
24372437
2438 @property2438 @property
@@ -2467,7 +2467,7 @@ class ProjectAddStepTwo(StepView, ProductLicenseMixin, ReturnToReferrerMixin):
24672467
2468 def setUpFields(self):2468 def setUpFields(self):
2469 """See `LaunchpadFormView`."""2469 """See `LaunchpadFormView`."""
2470 super(ProjectAddStepTwo, self).setUpFields()2470 super().setUpFields()
2471 hidden_names = ['__visited_steps__', 'license_info']2471 hidden_names = ['__visited_steps__', 'license_info']
2472 hidden_fields = self.form_fields.select(*hidden_names)2472 hidden_fields = self.form_fields.select(*hidden_names)
24732473
@@ -2502,7 +2502,7 @@ class ProjectAddStepTwo(StepView, ProductLicenseMixin, ReturnToReferrerMixin):
25022502
2503 def setUpWidgets(self):2503 def setUpWidgets(self):
2504 """See `LaunchpadFormView`."""2504 """See `LaunchpadFormView`."""
2505 super(ProjectAddStepTwo, self).setUpWidgets()2505 super().setUpWidgets()
2506 self.widgets['name'].read_only = True2506 self.widgets['name'].read_only = True
2507 # The "hint" is really more of an explanation at this point, but the2507 # The "hint" is really more of an explanation at this point, but the
2508 # phrasing is different.2508 # phrasing is different.
diff --git a/lib/lp/registry/browser/productrelease.py b/lib/lp/registry/browser/productrelease.py
index 9bb9242..ac680b8 100644
--- a/lib/lp/registry/browser/productrelease.py
+++ b/lib/lp/registry/browser/productrelease.py
@@ -167,10 +167,10 @@ class ProductReleaseAddView(ProductReleaseAddViewBase):
167 self.request.response.redirect(167 self.request.response.redirect(
168 canonical_url(self.context.product_release) + '/+edit')168 canonical_url(self.context.product_release) + '/+edit')
169 else:169 else:
170 super(ProductReleaseAddView, self).initialize()170 super().initialize()
171171
172 def setUpFields(self):172 def setUpFields(self):
173 super(ProductReleaseAddView, self).setUpFields()173 super().setUpFields()
174 if self.context.active is True:174 if self.context.active is True:
175 self._prependKeepMilestoneActiveField()175 self._prependKeepMilestoneActiveField()
176176
@@ -193,7 +193,7 @@ class ProductReleaseFromSeriesAddView(ProductReleaseAddViewBase,
193 ]193 ]
194194
195 def setUpFields(self):195 def setUpFields(self):
196 super(ProductReleaseFromSeriesAddView, self).setUpFields()196 super().setUpFields()
197 self._prependKeepMilestoneActiveField()197 self._prependKeepMilestoneActiveField()
198 self._prependMilestoneField()198 self._prependMilestoneField()
199199
@@ -288,7 +288,7 @@ class ProductReleaseAddDownloadFileView(LaunchpadFormView):
288 if file_name and self.context.hasReleaseFile(file_name):288 if file_name and self.context.hasReleaseFile(file_name):
289 self.setFieldError(289 self.setFieldError(
290 'filecontent',290 'filecontent',
291 u"The file '%s' is already uploaded." % file_name)291 "The file '%s' is already uploaded." % file_name)
292292
293 @action('Upload', name='add')293 @action('Upload', name='add')
294 def add_action(self, action, data):294 def add_action(self, action, data):
diff --git a/lib/lp/registry/browser/productseries.py b/lib/lp/registry/browser/productseries.py
index 8af4afb..707b077 100644
--- a/lib/lp/registry/browser/productseries.py
+++ b/lib/lp/registry/browser/productseries.py
@@ -197,7 +197,7 @@ class ProductSeriesInvolvementView(PillarInvolvementView):
197 has_involvement = True197 has_involvement = True
198198
199 def __init__(self, context, request):199 def __init__(self, context, request):
200 super(ProductSeriesInvolvementView, self).__init__(context, request)200 super().__init__(context, request)
201 self.answers_usage = ServiceUsage.NOT_APPLICABLE201 self.answers_usage = ServiceUsage.NOT_APPLICABLE
202 if self.context.branch is not None:202 if self.context.branch is not None:
203 self.codehosting_usage = ServiceUsage.LAUNCHPAD203 self.codehosting_usage = ServiceUsage.LAUNCHPAD
@@ -370,7 +370,7 @@ class ProductSeriesView(
370 """A view to show a series with translations."""370 """A view to show a series with translations."""
371371
372 def initialize(self):372 def initialize(self):
373 super(ProductSeriesView, self).initialize()373 super().initialize()
374 expose_structural_subscription_data_to_js(374 expose_structural_subscription_data_to_js(
375 self.context, self.request, self.user)375 self.context, self.request, self.user)
376376
@@ -506,8 +506,7 @@ class ProductSeriesUbuntuPackagingView(LaunchpadFormView):
506506
507 def __init__(self, context, request):507 def __init__(self, context, request):
508 """Set the static packaging information for this series."""508 """Set the static packaging information for this series."""
509 super(ProductSeriesUbuntuPackagingView, self).__init__(509 super().__init__(context, request)
510 context, request)
511 self._ubuntu = getUtility(ILaunchpadCelebrities).ubuntu510 self._ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
512 self._ubuntu_series = self._ubuntu.currentseries511 self._ubuntu_series = self._ubuntu.currentseries
513 try:512 try:
@@ -534,7 +533,7 @@ class ProductSeriesUbuntuPackagingView(LaunchpadFormView):
534 The packaging is restricted to ubuntu series and the default value533 The packaging is restricted to ubuntu series and the default value
535 is the current development series.534 is the current development series.
536 """535 """
537 super(ProductSeriesUbuntuPackagingView, self).setUpFields()536 super().setUpFields()
538 series_vocabulary = SimpleVocabulary(537 series_vocabulary = SimpleVocabulary(
539 [SimpleTerm(series, series.name, series.named_version)538 [SimpleTerm(series, series.name, series.named_version)
540 for series in self._ubuntu.series])539 for series in self._ubuntu.series])
diff --git a/lib/lp/registry/browser/project.py b/lib/lp/registry/browser/project.py
index 3927fc6..2a7ee6a 100644
--- a/lib/lp/registry/browser/project.py
+++ b/lib/lp/registry/browser/project.py
@@ -136,7 +136,7 @@ class ProjectNavigation(Navigation,
136136
137 @stepthrough('+tags')137 @stepthrough('+tags')
138 def traverse_tags(self, name):138 def traverse_tags(self, name):
139 tags = name.split(u',')139 tags = name.split(',')
140 if validate_tags(tags):140 if validate_tags(tags):
141 return ProjectGroupMilestoneTag(self.context, tags)141 return ProjectGroupMilestoneTag(self.context, tags)
142142
@@ -354,7 +354,7 @@ class ProjectView(PillarViewMixin, HasAnnouncementsView, FeedsMixin):
354 help_link="/+help-registry/driver.html", show_create_team=True)354 help_link="/+help-registry/driver.html", show_create_team=True)
355355
356 def initialize(self):356 def initialize(self):
357 super(ProjectView, self).initialize()357 super().initialize()
358 expose_structural_subscription_data_to_js(358 expose_structural_subscription_data_to_js(
359 self.context, self.request, self.user)359 self.context, self.request, self.user)
360360
@@ -422,7 +422,7 @@ class ProjectReviewView(ProjectEditView):
422 moderator = check_permission('launchpad.Moderate', self.context)422 moderator = check_permission('launchpad.Moderate', self.context)
423 if not moderator:423 if not moderator:
424 self.field_names.remove('name')424 self.field_names.remove('name')
425 super(ProjectReviewView, self).setUpFields()425 super().setUpFields()
426 self.form_fields = self._createAliasesField() + self.form_fields426 self.form_fields = self._createAliasesField() + self.form_fields
427 if admin:427 if admin:
428 self.form_fields = (428 self.form_fields = (
@@ -544,7 +544,7 @@ class ProjectSetView(LaunchpadView):
544 page_title = "Project groups registered in Launchpad"544 page_title = "Project groups registered in Launchpad"
545545
546 def __init__(self, context, request):546 def __init__(self, context, request):
547 super(ProjectSetView, self).__init__(context, request)547 super().__init__(context, request)
548 self.form = self.request.form_ng548 self.form = self.request.form_ng
549 self.search_string = self.form.getOne('text', None)549 self.search_string = self.form.getOne('text', None)
550 self.search_requested = False550 self.search_requested = False
diff --git a/lib/lp/registry/browser/sourcepackage.py b/lib/lp/registry/browser/sourcepackage.py
index ea447c2..43e6fb7 100644
--- a/lib/lp/registry/browser/sourcepackage.py
+++ b/lib/lp/registry/browser/sourcepackage.py
@@ -265,7 +265,7 @@ class SourcePackageChangeUpstreamStepOne(ReturnToReferrerMixin, StepView):
265 product = None265 product = None
266266
267 def setUpFields(self):267 def setUpFields(self):
268 super(SourcePackageChangeUpstreamStepOne, self).setUpFields()268 super().setUpFields()
269 series = self.context.productseries269 series = self.context.productseries
270 if series is not None:270 if series is not None:
271 default = series.product271 default = series.product
@@ -284,7 +284,7 @@ class SourcePackageChangeUpstreamStepOne(ReturnToReferrerMixin, StepView):
284 self.request.form['product'] = data['product']284 self.request.form['product'] = data['product']
285285
286 def validateStep(self, data):286 def validateStep(self, data):
287 super(SourcePackageChangeUpstreamStepOne, self).validateStep(data)287 super().validateStep(data)
288 product = data.get('product')288 product = data.get('product')
289 if product is None:289 if product is None:
290 return290 return
@@ -318,7 +318,7 @@ class SourcePackageChangeUpstreamStepTwo(ReturnToReferrerMixin, StepView):
318 custom_widget_productseries = LaunchpadRadioWidget318 custom_widget_productseries = LaunchpadRadioWidget
319319
320 def setUpFields(self):320 def setUpFields(self):
321 super(SourcePackageChangeUpstreamStepTwo, self).setUpFields()321 super().setUpFields()
322322
323 # The vocabulary for the product series is overridden to just323 # The vocabulary for the product series is overridden to just
324 # include active series from the product selected in the324 # include active series from the product selected in the
@@ -380,7 +380,7 @@ class SourcePackageChangeUpstreamStepTwo(ReturnToReferrerMixin, StepView):
380 # is called.380 # is called.
381 next_url = None381 next_url = None
382382
383 main_action_label = u'Change'383 main_action_label = 'Change'
384384
385 def main_action(self, data):385 def main_action(self, data):
386 productseries = data['productseries']386 productseries = data['productseries']
@@ -564,7 +564,7 @@ class SourcePackageAssociationPortletView(LaunchpadFormView):
564564
565 def setUpFields(self):565 def setUpFields(self):
566 """See `LaunchpadFormView`."""566 """See `LaunchpadFormView`."""
567 super(SourcePackageAssociationPortletView, self).setUpFields()567 super().setUpFields()
568 self.request.annotations['show_edit_buttons'] = True568 self.request.annotations['show_edit_buttons'] = True
569 # Find registered products that are similarly named to the source569 # Find registered products that are similarly named to the source
570 # package.570 # package.
diff --git a/lib/lp/registry/browser/team.py b/lib/lp/registry/browser/team.py
index eeefcee..c37bbf0 100644
--- a/lib/lp/registry/browser/team.py
+++ b/lib/lp/registry/browser/team.py
@@ -42,7 +42,6 @@ from lazr.restful.interfaces import IJSONRequestCache
42from lazr.restful.utils import smartquote42from lazr.restful.utils import smartquote
43import pytz43import pytz
44import simplejson44import simplejson
45import six
46from six.moves.urllib.parse import unquote45from six.moves.urllib.parse import unquote
47from zope.browserpage import ViewPageTemplateFile46from zope.browserpage import ViewPageTemplateFile
48from zope.component import getUtility47from zope.component import getUtility
@@ -219,14 +218,12 @@ class HasRenewalPolicyMixin:
219 def isMultiLineLayout(self, field_name):218 def isMultiLineLayout(self, field_name):
220 if field_name == 'renewal_policy':219 if field_name == 'renewal_policy':
221 return True220 return True
222 return super(HasRenewalPolicyMixin, self).isMultiLineLayout(221 return super().isMultiLineLayout(field_name)
223 field_name)
224222
225 def isSingleLineLayout(self, field_name):223 def isSingleLineLayout(self, field_name):
226 if field_name == 'renewal_policy':224 if field_name == 'renewal_policy':
227 return False225 return False
228 return super(HasRenewalPolicyMixin, self).isSingleLineLayout(226 return super().isSingleLineLayout(field_name)
229 field_name)
230227
231228
232class TeamFormMixin:229class TeamFormMixin:
@@ -317,11 +314,11 @@ class TeamEditView(TeamFormMixin, PersonRenameFormMixin,
317 # class list.314 # class list.
318 self.field_names = list(self.field_names)315 self.field_names = list(self.field_names)
319 self.field_names.remove('teamowner')316 self.field_names.remove('teamowner')
320 super(TeamEditView, self).setUpFields()317 super().setUpFields()
321 self.setUpVisibilityField(render_context=True)318 self.setUpVisibilityField(render_context=True)
322319
323 def setUpWidgets(self):320 def setUpWidgets(self):
324 super(TeamEditView, self).setUpWidgets()321 super().setUpWidgets()
325 team = self.context322 team = self.context
326 # Do we need to only show open membership policy choices?323 # Do we need to only show open membership policy choices?
327 try:324 try:
@@ -457,7 +454,7 @@ class TeamContactAddressView(MailingListTeamBaseView):
457 def setUpFields(self):454 def setUpFields(self):
458 """See `LaunchpadFormView`.455 """See `LaunchpadFormView`.
459 """456 """
460 super(TeamContactAddressView, self).setUpFields()457 super().setUpFields()
461458
462 # Replace the default contact_method field by a custom one.459 # Replace the default contact_method field by a custom one.
463 self.form_fields = (460 self.form_fields = (
@@ -525,7 +522,7 @@ class TeamContactAddressView(MailingListTeamBaseView):
525 # responsibility for security on the exception thrower.522 # responsibility for security on the exception thrower.
526 msg = error.args[0]523 msg = error.args[0]
527 if not IStructuredString.providedBy(msg):524 if not IStructuredString.providedBy(msg):
528 msg = structured(six.text_type(msg))525 msg = structured(str(msg))
529 self.setFieldError('contact_address', msg)526 self.setFieldError('contact_address', msg)
530 elif data['contact_method'] == TeamContactMethod.HOSTED_LIST:527 elif data['contact_method'] == TeamContactMethod.HOSTED_LIST:
531 mailing_list = getUtility(IMailingListSet).get(self.context.name)528 mailing_list = getUtility(IMailingListSet).get(self.context.name)
@@ -621,8 +618,7 @@ class TeamMailingListConfigurationView(MailingListTeamBaseView):
621 address. Second, the mailing list may be in a transitional618 address. Second, the mailing list may be in a transitional
622 state: from MODIFIED to UPDATING to ACTIVE can take a while.619 state: from MODIFIED to UPDATING to ACTIVE can take a while.
623 """620 """
624 super(TeamMailingListConfigurationView, self).__init__(621 super().__init__(context, request)
625 context, request)
626 list_set = getUtility(IMailingListSet)622 list_set = getUtility(IMailingListSet)
627 self.mailing_list = list_set.get(self.context.name)623 self.mailing_list = list_set.get(self.context.name)
628624
@@ -903,7 +899,7 @@ class TeamMailingListModerationView(MailingListTeamBaseView):
903899
904 def __init__(self, context, request):900 def __init__(self, context, request):
905 """Allow for review and moderation of held mailing list posts."""901 """Allow for review and moderation of held mailing list posts."""
906 super(TeamMailingListModerationView, self).__init__(context, request)902 super().__init__(context, request)
907 list_set = getUtility(IMailingListSet)903 list_set = getUtility(IMailingListSet)
908 self.mailing_list = list_set.get(self.context.name)904 self.mailing_list = list_set.get(self.context.name)
909 if self.mailing_list is None:905 if self.mailing_list is None:
@@ -988,7 +984,7 @@ class TeamMailingListArchiveView(LaunchpadView):
988 label = "Mailing list archive"984 label = "Mailing list archive"
989985
990 def __init__(self, context, request):986 def __init__(self, context, request):
991 super(TeamMailingListArchiveView, self).__init__(context, request)987 super().__init__(context, request)
992 self.messages = self._get_messages()988 self.messages = self._get_messages()
993 cache = IJSONRequestCache(request).objects989 cache = IJSONRequestCache(request).objects
994 cache['mail'] = self.messages990 cache['mail'] = self.messages
@@ -1021,7 +1017,7 @@ class TeamAddView(TeamFormMixin, HasRenewalPolicyMixin, LaunchpadFormView):
10211017
1022 Only Launchpad Admins get to see the visibility field.1018 Only Launchpad Admins get to see the visibility field.
1023 """1019 """
1024 super(TeamAddView, self).setUpFields()1020 super().setUpFields()
1025 self.setUpVisibilityField()1021 self.setUpVisibilityField()
10261022
1027 @action('Create Team', name='create',1023 @action('Create Team', name='create',
@@ -1201,7 +1197,7 @@ class TeamMemberAddView(LaunchpadFormView):
1201 if error:1197 if error:
1202 self.setFieldError("newmember", error)1198 self.setFieldError("newmember", error)
12031199
1204 @action(u"Add Member", name="add")1200 @action("Add Member", name="add")
1205 def add_action(self, action, data):1201 def add_action(self, action, data):
1206 """Add the new member to the team."""1202 """Add the new member to the team."""
1207 newmember = data['newmember']1203 newmember = data['newmember']
@@ -1778,7 +1774,7 @@ class TeamJoinView(LaunchpadFormView, TeamJoinMixin):
1778 page_title = label1774 page_title = label
17791775
1780 def setUpWidgets(self):1776 def setUpWidgets(self):
1781 super(TeamJoinView, self).setUpWidgets()1777 super().setUpWidgets()
1782 if 'mailinglist_subscribe' in self.field_names:1778 if 'mailinglist_subscribe' in self.field_names:
1783 widget = self.widgets['mailinglist_subscribe']1779 widget = self.widgets['mailinglist_subscribe']
1784 widget.setRenderedValue(self.user_wants_list_subscriptions)1780 widget.setRenderedValue(self.user_wants_list_subscriptions)
@@ -1914,7 +1910,7 @@ class TeamAddMyTeamsView(LaunchpadFormView):
1914 else:1910 else:
1915 self.label = 'Add these teams to %s' % context.displayname1911 self.label = 'Add these teams to %s' % context.displayname
1916 self.next_url = canonical_url(context)1912 self.next_url = canonical_url(context)
1917 super(TeamAddMyTeamsView, self).initialize()1913 super().initialize()
19181914
1919 def setUpFields(self):1915 def setUpFields(self):
1920 terms = []1916 terms = []
@@ -1930,7 +1926,7 @@ class TeamAddMyTeamsView(LaunchpadFormView):
1930 render_context=self.render_context)1926 render_context=self.render_context)
19311927
1932 def setUpWidgets(self, context=None):1928 def setUpWidgets(self, context=None):
1933 super(TeamAddMyTeamsView, self).setUpWidgets(context)1929 super().setUpWidgets(context)
1934 self.widgets['teams'].display_label = False1930 self.widgets['teams'].display_label = False
19351931
1936 @cachedproperty1932 @cachedproperty
@@ -2063,7 +2059,7 @@ class TeamReassignmentView(ObjectReassignmentView):
2063 schema = ITeamReassignment2059 schema = ITeamReassignment
20642060
2065 def __init__(self, context, request):2061 def __init__(self, context, request):
2066 super(TeamReassignmentView, self).__init__(context, request)2062 super().__init__(context, request)
2067 self.callback = self._afterOwnerChange2063 self.callback = self._afterOwnerChange
2068 self.teamdisplayname = self.contextName2064 self.teamdisplayname = self.contextName
2069 self._next_url = canonical_url(self.context)2065 self._next_url = canonical_url(self.context)
diff --git a/lib/lp/registry/browser/teammembership.py b/lib/lp/registry/browser/teammembership.py
index ef62f97..3610e3e 100644
--- a/lib/lp/registry/browser/teammembership.py
+++ b/lib/lp/registry/browser/teammembership.py
@@ -38,7 +38,7 @@ class TeamMembershipBreadcrumb(Breadcrumb):
38class TeamMembershipEditView(LaunchpadView):38class TeamMembershipEditView(LaunchpadView):
3939
40 def __init__(self, context, request):40 def __init__(self, context, request):
41 super(TeamMembershipEditView, self).__init__(context, request)41 super().__init__(context, request)
42 self.errormessage = ""42 self.errormessage = ""
43 self.prefix = 'membership'43 self.prefix = 'membership'
44 self.max_year = 205044 self.max_year = 2050
diff --git a/lib/lp/registry/browser/tests/test_announcements.py b/lib/lp/registry/browser/tests/test_announcements.py
index b79d42e..5f005c6 100644
--- a/lib/lp/registry/browser/tests/test_announcements.py
+++ b/lib/lp/registry/browser/tests/test_announcements.py
@@ -30,8 +30,8 @@ class TestAnnouncement(TestCaseWithFactory):
30 layer = LaunchpadFunctionalLayer30 layer = LaunchpadFunctionalLayer
3131
32 def test_announcement_info(self):32 def test_announcement_info(self):
33 product = self.factory.makeProduct(displayname=u"Foo")33 product = self.factory.makeProduct(displayname="Foo")
34 announcer = self.factory.makePerson(displayname=u"Bar Baz")34 announcer = self.factory.makePerson(displayname="Bar Baz")
35 announcement = product.announce(announcer, "Hello World")35 announcement = product.announce(announcer, "Hello World")
36 view = create_initialized_view(announcement, "+index")36 view = create_initialized_view(announcement, "+index")
37 root = html.fromstring(view())37 root = html.fromstring(view())
@@ -41,8 +41,8 @@ class TestAnnouncement(TestCaseWithFactory):
41 normalize_whitespace(reg_para.text_content()))41 normalize_whitespace(reg_para.text_content()))
4242
43 def test_announcement_info_with_publication_date(self):43 def test_announcement_info_with_publication_date(self):
44 product = self.factory.makeProduct(displayname=u"Foo")44 product = self.factory.makeProduct(displayname="Foo")
45 announcer = self.factory.makePerson(displayname=u"Bar Baz")45 announcer = self.factory.makePerson(displayname="Bar Baz")
46 announced = datetime(2007, 1, 12, tzinfo=utc)46 announced = datetime(2007, 1, 12, tzinfo=utc)
47 announcement = product.announce(47 announcement = product.announce(
48 announcer, "Hello World", publication_date=announced)48 announcer, "Hello World", publication_date=announced)
diff --git a/lib/lp/registry/browser/tests/test_branding.py b/lib/lp/registry/browser/tests/test_branding.py
index 1b2d321..7c1ba39 100644
--- a/lib/lp/registry/browser/tests/test_branding.py
+++ b/lib/lp/registry/browser/tests/test_branding.py
@@ -14,7 +14,7 @@ class TestBrandingChangeView(TestCaseWithFactory):
14 layer = DatabaseFunctionalLayer14 layer = DatabaseFunctionalLayer
1515
16 def setUp(self):16 def setUp(self):
17 super(TestBrandingChangeView, self).setUp()17 super().setUp()
18 self.context = self.factory.makePerson(name='cow')18 self.context = self.factory.makePerson(name='cow')
19 self.view = BrandingChangeView(self.context, LaunchpadTestRequest())19 self.view = BrandingChangeView(self.context, LaunchpadTestRequest())
2020
diff --git a/lib/lp/registry/browser/tests/test_breadcrumbs.py b/lib/lp/registry/browser/tests/test_breadcrumbs.py
index 459a259..10bd2e9 100644
--- a/lib/lp/registry/browser/tests/test_breadcrumbs.py
+++ b/lib/lp/registry/browser/tests/test_breadcrumbs.py
@@ -17,7 +17,7 @@ class TestPillarSharingBreadcrumb(BaseBreadcrumbTestCase, SharingBaseTestCase):
17 pillar_type = 'product'17 pillar_type = 'product'
1818
19 def setUp(self):19 def setUp(self):
20 super(TestPillarSharingBreadcrumb, self).setUp()20 super().setUp()
21 login_person(self.driver)21 login_person(self.driver)
2222
23 def test_sharing_breadcrumb(self):23 def test_sharing_breadcrumb(self):
@@ -44,7 +44,7 @@ class TestDistroseriesBreadcrumb(BaseBreadcrumbTestCase):
44 """Test breadcrumbs for an `IDistroseries`."""44 """Test breadcrumbs for an `IDistroseries`."""
4545
46 def setUp(self):46 def setUp(self):
47 super(TestDistroseriesBreadcrumb, self).setUp()47 super().setUp()
48 self.distribution = self.factory.makeDistribution(48 self.distribution = self.factory.makeDistribution(
49 name='youbuntu', displayname='Youbuntu')49 name='youbuntu', displayname='Youbuntu')
50 self.distroseries = self.factory.makeDistroSeries(50 self.distroseries = self.factory.makeDistroSeries(
@@ -61,7 +61,7 @@ class TestDistributionMirrorBreadcrumb(BaseBreadcrumbTestCase):
61 """Test breadcrumbs for an `IDistributionMirror`."""61 """Test breadcrumbs for an `IDistributionMirror`."""
6262
63 def setUp(self):63 def setUp(self):
64 super(TestDistributionMirrorBreadcrumb, self).setUp()64 super().setUp()
65 self.distribution = getUtility(ILaunchpadCelebrities).ubuntu65 self.distribution = getUtility(ILaunchpadCelebrities).ubuntu
6666
67 def test_distributionmirror_withDisplayName(self):67 def test_distributionmirror_withDisplayName(self):
@@ -104,7 +104,7 @@ class TestMilestoneBreadcrumb(BaseBreadcrumbTestCase):
104 """Test the breadcrumbs for an `IMilestone`."""104 """Test the breadcrumbs for an `IMilestone`."""
105105
106 def setUp(self):106 def setUp(self):
107 super(TestMilestoneBreadcrumb, self).setUp()107 super().setUp()
108 self.project = self.factory.makeProduct()108 self.project = self.factory.makeProduct()
109 self.series = self.factory.makeProductSeries(product=self.project)109 self.series = self.factory.makeProductSeries(product=self.project)
110 self.milestone = self.factory.makeMilestone(110 self.milestone = self.factory.makeMilestone(
@@ -136,7 +136,7 @@ class TestPollBreadcrumb(BaseBreadcrumbTestCase):
136 """Test breadcrumbs for an `IPoll`."""136 """Test breadcrumbs for an `IPoll`."""
137137
138 def setUp(self):138 def setUp(self):
139 super(TestPollBreadcrumb, self).setUp()139 super().setUp()
140 self.team = self.factory.makeTeam(displayname="Poll Team")140 self.team = self.factory.makeTeam(displayname="Poll Team")
141 name = "pollo-poll"141 name = "pollo-poll"
142 title = "Marco Pollo"142 title = "Marco Pollo"
@@ -157,7 +157,7 @@ class TestNameblacklistBreadcrumb(BaseBreadcrumbTestCase):
157 """Test breadcrumbs for +nameblacklist."""157 """Test breadcrumbs for +nameblacklist."""
158158
159 def setUp(self):159 def setUp(self):
160 super(TestNameblacklistBreadcrumb, self).setUp()160 super().setUp()
161 self.name_blacklist_set = getUtility(INameBlacklistSet)161 self.name_blacklist_set = getUtility(INameBlacklistSet)
162 self.registry_expert = self.factory.makeRegistryExpert()162 self.registry_expert = self.factory.makeRegistryExpert()
163 login_person(self.registry_expert)163 login_person(self.registry_expert)
@@ -167,7 +167,7 @@ class TestNameblacklistBreadcrumb(BaseBreadcrumbTestCase):
167 self.assertBreadcrumbs(expected, self.name_blacklist_set)167 self.assertBreadcrumbs(expected, self.name_blacklist_set)
168168
169 def test_nameblacklist_edit(self):169 def test_nameblacklist_edit(self):
170 blacklist = self.name_blacklist_set.getByRegExp(u'blacklist')170 blacklist = self.name_blacklist_set.getByRegExp('blacklist')
171 expected = [171 expected = [
172 ('Name Blacklist',172 ('Name Blacklist',
173 'http://launchpad.test/+nameblacklist'),173 'http://launchpad.test/+nameblacklist'),
diff --git a/lib/lp/registry/browser/tests/test_codeofconduct.py b/lib/lp/registry/browser/tests/test_codeofconduct.py
index f52b93b..b270f70 100644
--- a/lib/lp/registry/browser/tests/test_codeofconduct.py
+++ b/lib/lp/registry/browser/tests/test_codeofconduct.py
@@ -25,7 +25,7 @@ class TestSignedCodeOfConductAckView(TestCaseWithFactory):
25 layer = DatabaseFunctionalLayer25 layer = DatabaseFunctionalLayer
2626
27 def setUp(self):27 def setUp(self):
28 super(TestSignedCodeOfConductAckView, self).setUp()28 super().setUp()
29 self.signed_coc_set = getUtility(ISignedCodeOfConductSet)29 self.signed_coc_set = getUtility(ISignedCodeOfConductSet)
30 self.owner = self.factory.makePerson()30 self.owner = self.factory.makePerson()
31 self.admin = login_celebrity('admin')31 self.admin = login_celebrity('admin')
@@ -60,7 +60,7 @@ class SignCodeOfConductTestCase(TestCaseWithFactory):
60 layer = DatabaseFunctionalLayer60 layer = DatabaseFunctionalLayer
6161
62 def setUp(self):62 def setUp(self):
63 super(SignCodeOfConductTestCase, self).setUp()63 super().setUp()
64 user = self.factory.makePerson()64 user = self.factory.makePerson()
65 gpg_key = self.factory.makeGPGKey(user)65 gpg_key = self.factory.makeGPGKey(user)
66 self.signed_coc = self.sign_coc(user, gpg_key)66 self.signed_coc = self.sign_coc(user, gpg_key)
diff --git a/lib/lp/registry/browser/tests/test_distribution.py b/lib/lp/registry/browser/tests/test_distribution.py
index f75dce0..3f3ac9c 100644
--- a/lib/lp/registry/browser/tests/test_distribution.py
+++ b/lib/lp/registry/browser/tests/test_distribution.py
@@ -336,9 +336,9 @@ class TestDistributionPage(TestCaseWithFactory):
336 layer = DatabaseFunctionalLayer336 layer = DatabaseFunctionalLayer
337337
338 def setUp(self):338 def setUp(self):
339 super(TestDistributionPage, self).setUp()339 super().setUp()
340 self.distro = self.factory.makeDistribution(340 self.distro = self.factory.makeDistribution(
341 name="distro", displayname=u'distro')341 name="distro", displayname='distro')
342 self.simple_user = self.factory.makePerson()342 self.simple_user = self.factory.makePerson()
343 # Use a FakeLogger fixture to prevent Memcached warnings to be343 # Use a FakeLogger fixture to prevent Memcached warnings to be
344 # printed to stdout while browsing pages.344 # printed to stdout while browsing pages.
@@ -510,9 +510,9 @@ class TestDistributionView(TestCaseWithFactory):
510 layer = DatabaseFunctionalLayer510 layer = DatabaseFunctionalLayer
511511
512 def setUp(self):512 def setUp(self):
513 super(TestDistributionView, self).setUp()513 super().setUp()
514 self.distro = self.factory.makeDistribution(514 self.distro = self.factory.makeDistribution(
515 name="distro", displayname=u'distro')515 name="distro", displayname='distro')
516516
517 def test_view_data_model(self):517 def test_view_data_model(self):
518 # The view's json request cache contains the expected data.518 # The view's json request cache contains the expected data.
diff --git a/lib/lp/registry/browser/tests/test_distribution_views.py b/lib/lp/registry/browser/tests/test_distribution_views.py
index ad7956d..252bf72 100644
--- a/lib/lp/registry/browser/tests/test_distribution_views.py
+++ b/lib/lp/registry/browser/tests/test_distribution_views.py
@@ -38,13 +38,13 @@ class TestDistributionPublisherConfigView(TestCaseWithFactory):
3838
39 def setUp(self):39 def setUp(self):
40 # Create a test distribution.40 # Create a test distribution.
41 super(TestDistributionPublisherConfigView, self).setUp()41 super().setUp()
42 self.distro = self.factory.makeDistribution(no_pubconf=True)42 self.distro = self.factory.makeDistribution(no_pubconf=True)
43 login(LAUNCHPAD_ADMIN)43 login(LAUNCHPAD_ADMIN)
4444
45 self.ROOT_DIR = u"rootdir/test"45 self.ROOT_DIR = "rootdir/test"
46 self.BASE_URL = u"http://base.url"46 self.BASE_URL = "http://base.url"
47 self.COPY_BASE_URL = u"http://copybase.url"47 self.COPY_BASE_URL = "http://copybase.url"
4848
49 def test_empty_initial_values(self):49 def test_empty_initial_values(self):
50 # Test that the page will display empty field values with no50 # Test that the page will display empty field values with no
@@ -53,7 +53,7 @@ class TestDistributionPublisherConfigView(TestCaseWithFactory):
53 self.distro, LaunchpadTestRequest())53 self.distro, LaunchpadTestRequest())
5454
55 for value in view.initial_values:55 for value in view.initial_values:
56 self.assertEqual(u"", value)56 self.assertEqual("", value)
5757
58 def test_previous_initial_values(self):58 def test_previous_initial_values(self):
59 # Test that the initial values are the same as the ones in the59 # Test that the initial values are the same as the ones in the
@@ -96,9 +96,9 @@ class TestDistributionPublisherConfigView(TestCaseWithFactory):
96 # Test POSTing to change existing config.96 # Test POSTing to change existing config.
97 self.factory.makePublisherConfig(97 self.factory.makePublisherConfig(
98 distribution=self.distro,98 distribution=self.distro,
99 root_dir=u"random",99 root_dir="random",
100 base_url=u"blah",100 base_url="blah",
101 copy_base_url=u"foo",101 copy_base_url="foo",
102 )102 )
103 self._change_and_test_config()103 self._change_and_test_config()
104104
@@ -109,7 +109,7 @@ class TestDistroAddView(TestCaseWithFactory):
109 layer = DatabaseFunctionalLayer109 layer = DatabaseFunctionalLayer
110110
111 def setUp(self):111 def setUp(self):
112 super(TestDistroAddView, self).setUp()112 super().setUp()
113 self.owner = self.factory.makePerson()113 self.owner = self.factory.makePerson()
114 self.registrant = self.factory.makePerson()114 self.registrant = self.factory.makePerson()
115 self.simple_user = self.factory.makePerson()115 self.simple_user = self.factory.makePerson()
@@ -189,7 +189,7 @@ class TestDistroEditView(OCIConfigHelperMixin, TestCaseWithFactory):
189 layer = DatabaseFunctionalLayer189 layer = DatabaseFunctionalLayer
190190
191 def setUp(self):191 def setUp(self):
192 super(TestDistroEditView, self).setUp()192 super().setUp()
193 self.admin = login_celebrity('admin')193 self.admin = login_celebrity('admin')
194 self.oci_admins = self.factory.makeTeam(194 self.oci_admins = self.factory.makeTeam(
195 members=[self.admin])195 members=[self.admin])
@@ -226,7 +226,7 @@ class TestDistroEditView(OCIConfigHelperMixin, TestCaseWithFactory):
226 'field.title': 'newbuntu',226 'field.title': 'newbuntu',
227 'field.summary': 'newbuntu',227 'field.summary': 'newbuntu',
228 'field.description': 'newbuntu',228 'field.description': 'newbuntu',
229 'field.require_virtualized.used': u'',229 'field.require_virtualized.used': '',
230 'field.processors': [proc.name for proc in self.all_processors],230 'field.processors': [proc.name for proc in self.all_processors],
231 'field.actions.change': 'Change',231 'field.actions.change': 'Change',
232 }232 }
@@ -496,7 +496,7 @@ class TestDistroReassignView(TestCaseWithFactory):
496 layer = DatabaseFunctionalLayer496 layer = DatabaseFunctionalLayer
497497
498 def setUp(self):498 def setUp(self):
499 super(TestDistroReassignView, self).setUp()499 super().setUp()
500 self.owner = self.factory.makePerson()500 self.owner = self.factory.makePerson()
501 self.registrant = self.factory.makePerson()501 self.registrant = self.factory.makePerson()
502 self.simple_user = self.factory.makePerson()502 self.simple_user = self.factory.makePerson()
diff --git a/lib/lp/registry/browser/tests/test_distributionsourcepackage.py b/lib/lp/registry/browser/tests/test_distributionsourcepackage.py
index 0ae0087..3de69df 100644
--- a/lib/lp/registry/browser/tests/test_distributionsourcepackage.py
+++ b/lib/lp/registry/browser/tests/test_distributionsourcepackage.py
@@ -42,8 +42,8 @@ class TestDistributionSourcePackageFormatterAPI(TestCaseWithFactory):
42 ubuntu = getUtility(ILaunchpadCelebrities).ubuntu42 ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
43 dsp = ubuntu.getSourcePackage('mouse')43 dsp = ubuntu.getSourcePackage('mouse')
44 markup = (44 markup = (
45 u'<a href="/ubuntu/+source/mouse" class="sprite package-source">'45 '<a href="/ubuntu/+source/mouse" class="sprite package-source">'
46 u'mouse in Ubuntu</a>')46 'mouse in Ubuntu</a>')
47 self.assertEqual(markup, test_tales('dsp/fmt:link', dsp=dsp))47 self.assertEqual(markup, test_tales('dsp/fmt:link', dsp=dsp))
4848
4949
@@ -157,7 +157,7 @@ class TestDistributionSourceView(TestCaseWithFactory):
157 layer = DatabaseFunctionalLayer157 layer = DatabaseFunctionalLayer
158158
159 def setUp(self):159 def setUp(self):
160 super(TestDistributionSourceView, self).setUp()160 super().setUp()
161 self.factory.makeSourcePackageName('mouse')161 self.factory.makeSourcePackageName('mouse')
162 distro = self.factory.makeDistribution()162 distro = self.factory.makeDistribution()
163 self.dsp = distro.getSourcePackage('mouse')163 self.dsp = distro.getSourcePackage('mouse')
diff --git a/lib/lp/registry/browser/tests/test_distroseries.py b/lib/lp/registry/browser/tests/test_distroseries.py
index e0d714e..326bbfd 100644
--- a/lib/lp/registry/browser/tests/test_distroseries.py
+++ b/lib/lp/registry/browser/tests/test_distroseries.py
@@ -244,7 +244,7 @@ class DistroSeriesIndexFunctionalTestCase(TestCaseWithFactory):
244 layer = DatabaseFunctionalLayer244 layer = DatabaseFunctionalLayer
245245
246 def setUp(self):246 def setUp(self):
247 super(DistroSeriesIndexFunctionalTestCase, self).setUp()247 super().setUp()
248 # Use a FakeLogger fixture to prevent Memcached warnings to be248 # Use a FakeLogger fixture to prevent Memcached warnings to be
249 # printed to stdout while browsing pages.249 # printed to stdout while browsing pages.
250 self.useFixture(FakeLogger())250 self.useFixture(FakeLogger())
@@ -501,7 +501,7 @@ class TestDistroSeriesDerivationPortlet(TestCaseWithFactory):
501 job.start()501 job.start()
502 job.fail()502 job.fail()
503 with person_logged_in(series.distribution.owner):503 with person_logged_in(series.distribution.owner):
504 series.distribution.owner.display_name = u"Bob Individual"504 series.distribution.owner.display_name = "Bob Individual"
505 with anonymous_logged_in():505 with anonymous_logged_in():
506 view = create_initialized_view(series, '+portlet-derivation')506 view = create_initialized_view(series, '+portlet-derivation')
507 html_content = view()507 html_content = view()
@@ -514,7 +514,7 @@ class TestDistroSeriesDerivationPortlet(TestCaseWithFactory):
514 # owner is an individual.514 # owner is an individual.
515 with person_logged_in(series.distribution.owner):515 with person_logged_in(series.distribution.owner):
516 series.distribution.owner = self.factory.makeTeam(516 series.distribution.owner = self.factory.makeTeam(
517 displayname=u"Team Teamy Team Team",517 displayname="Team Teamy Team Team",
518 membership_policy=TeamMembershipPolicy.RESTRICTED)518 membership_policy=TeamMembershipPolicy.RESTRICTED)
519 with anonymous_logged_in():519 with anonymous_logged_in():
520 view = create_initialized_view(series, '+portlet-derivation')520 view = create_initialized_view(series, '+portlet-derivation')
@@ -614,31 +614,31 @@ class TestDistroSeriesAddView(TestCaseWithFactory):
614 layer = DatabaseFunctionalLayer614 layer = DatabaseFunctionalLayer
615615
616 def setUp(self):616 def setUp(self):
617 super(TestDistroSeriesAddView, self).setUp()617 super().setUp()
618 self.user = self.factory.makePerson()618 self.user = self.factory.makePerson()
619 self.distribution = self.factory.makeDistribution(owner=self.user)619 self.distribution = self.factory.makeDistribution(owner=self.user)
620620
621 def createNewDistroseries(self):621 def createNewDistroseries(self):
622 form = {622 form = {
623 "field.name": u"polished",623 "field.name": "polished",
624 "field.version": u"12.04",624 "field.version": "12.04",
625 "field.display_name": u"Polished Polecat",625 "field.display_name": "Polished Polecat",
626 "field.summary": u"Even The Register likes it.",626 "field.summary": "Even The Register likes it.",
627 "field.actions.create": u"Add Series",627 "field.actions.create": "Add Series",
628 }628 }
629 with person_logged_in(self.user):629 with person_logged_in(self.user):
630 create_initialized_view(self.distribution, "+addseries",630 create_initialized_view(self.distribution, "+addseries",
631 form=form)631 form=form)
632 distroseries = self.distribution.getSeries(u"polished")632 distroseries = self.distribution.getSeries("polished")
633 return distroseries633 return distroseries
634634
635 def assertCreated(self, distroseries):635 def assertCreated(self, distroseries):
636 self.assertEqual(u"polished", distroseries.name)636 self.assertEqual("polished", distroseries.name)
637 self.assertEqual(u"12.04", distroseries.version)637 self.assertEqual("12.04", distroseries.version)
638 self.assertEqual(u"Polished Polecat", distroseries.display_name)638 self.assertEqual("Polished Polecat", distroseries.display_name)
639 self.assertEqual(u"Polished Polecat", distroseries.title)639 self.assertEqual("Polished Polecat", distroseries.title)
640 self.assertEqual(u"Even The Register likes it.", distroseries.summary)640 self.assertEqual("Even The Register likes it.", distroseries.summary)
641 self.assertEqual(u"", distroseries.description)641 self.assertEqual("", distroseries.description)
642 self.assertEqual(self.user, distroseries.owner)642 self.assertEqual(self.user, distroseries.owner)
643643
644 def test_plain_submit(self):644 def test_plain_submit(self):
@@ -684,10 +684,10 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory):
684 # process Javascript.684 # process Javascript.
685 [message] = root.cssselect("p.error.message")685 [message] = root.cssselect("p.error.message")
686 self.assertIn(686 self.assertIn(
687 u"Javascript is required to use this page",687 "Javascript is required to use this page",
688 message.text)688 message.text)
689 self.assertIn(689 self.assertIn(
690 u"javascript-disabled",690 "javascript-disabled",
691 message.get("class").split())691 message.get("class").split())
692692
693 def test_seriesToVocab(self):693 def test_seriesToVocab(self):
@@ -755,8 +755,8 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory):
755 [message] = root.cssselect("p.error.message")755 [message] = root.cssselect("p.error.message")
756 self.assertThat(756 self.assertThat(
757 message.text, EqualsIgnoringWhitespace(757 message.text, EqualsIgnoringWhitespace(
758 u"This series already contains source packages "758 "This series already contains source packages "
759 u"and cannot be initialized again."))759 "and cannot be initialized again."))
760760
761 def test_form_hidden_when_distroseries_is_being_initialized(self):761 def test_form_hidden_when_distroseries_is_being_initialized(self):
762 # The form is hidden when the series has already been derived.762 # The form is hidden when the series has already been derived.
@@ -770,7 +770,7 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory):
770 [message] = root.cssselect("p.error.message")770 [message] = root.cssselect("p.error.message")
771 self.assertThat(771 self.assertThat(
772 message.text, EqualsIgnoringWhitespace(772 message.text, EqualsIgnoringWhitespace(
773 u"This series is already being initialized."))773 "This series is already being initialized."))
774774
775 def test_form_hidden_when_previous_series_none(self):775 def test_form_hidden_when_previous_series_none(self):
776 # If the distribution has an initialized series and the776 # If the distribution has an initialized series and the
@@ -789,9 +789,9 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory):
789 [message] = root.cssselect("p.error.message")789 [message] = root.cssselect("p.error.message")
790 self.assertThat(790 self.assertThat(
791 message.text, EqualsIgnoringWhitespace(791 message.text, EqualsIgnoringWhitespace(
792 u'Unable to initialize series: the distribution '792 'Unable to initialize series: the distribution '
793 u'already has initialized series and this distroseries '793 'already has initialized series and this distroseries '
794 u'has no previous series.'))794 'has no previous series.'))
795795
796 def test_form_hidden_when_no_publisher_config_set_up(self):796 def test_form_hidden_when_no_publisher_config_set_up(self):
797 # If the distribution has no publisher config set up:797 # If the distribution has no publisher config set up:
@@ -807,8 +807,8 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory):
807 [message] = root.cssselect("p.error.message")807 [message] = root.cssselect("p.error.message")
808 self.assertThat(808 self.assertThat(
809 message.text, EqualsIgnoringWhitespace(809 message.text, EqualsIgnoringWhitespace(
810 u"The series' distribution has no publisher configuration. "810 "The series' distribution has no publisher configuration. "
811 u"Please ask an administrator to set this up."))811 "Please ask an administrator to set this up."))
812812
813813
814class TestDistroSeriesInitializeViewAccess(TestCaseWithFactory):814class TestDistroSeriesInitializeViewAccess(TestCaseWithFactory):
@@ -817,8 +817,7 @@ class TestDistroSeriesInitializeViewAccess(TestCaseWithFactory):
817 layer = LaunchpadFunctionalLayer817 layer = LaunchpadFunctionalLayer
818818
819 def setUp(self):819 def setUp(self):
820 super(TestDistroSeriesInitializeViewAccess,820 super().setUp('foo.bar@canonical.com')
821 self).setUp('foo.bar@canonical.com')
822821
823 def test_initseries_access_anon(self):822 def test_initseries_access_anon(self):
824 # Anonymous users cannot access +initseries.823 # Anonymous users cannot access +initseries.
@@ -898,8 +897,7 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory,
898 layer = DatabaseFunctionalLayer897 layer = DatabaseFunctionalLayer
899898
900 def setUp(self):899 def setUp(self):
901 super(TestDistroSeriesLocalDiffPerformance,900 super().setUp('foo.bar@canonical.com')
902 self).setUp('foo.bar@canonical.com')
903 self.simple_user = self.factory.makePerson()901 self.simple_user = self.factory.makePerson()
904902
905 def _assertQueryCount(self, derived_series):903 def _assertQueryCount(self, derived_series):
@@ -917,9 +915,9 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory,
917 for index in range(num):915 for index in range(num):
918 version = self.factory.getUniqueInteger()916 version = self.factory.getUniqueInteger()
919 versions = {917 versions = {
920 'base': u'1.%d' % version,918 'base': '1.%d' % version,
921 'derived': u'1.%dderived1' % version,919 'derived': '1.%dderived1' % version,
922 'parent': u'1.%d-1' % version,920 'parent': '1.%d-1' % version,
923 }921 }
924 dsd = self.factory.makeDistroSeriesDifference(922 dsd = self.factory.makeDistroSeriesDifference(
925 derived_series=derived_series,923 derived_series=derived_series,
@@ -965,8 +963,7 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory,
965963
966 def prepare_statements(rec):964 def prepare_statements(rec):
967 for statement in rec.statements:965 for statement in rec.statements:
968 for line in wrapper.wrap(statement):966 yield from wrapper.wrap(statement)
969 yield line
970 yield "-" * wrapper.width967 yield "-" * wrapper.width
971968
972 def statement_diff():969 def statement_diff():
@@ -983,19 +980,19 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory,
983 self.assertThat(recorder1, HasQueryCount(LessThan(30)))980 self.assertThat(recorder1, HasQueryCount(LessThan(30)))
984 self.addDetail(981 self.addDetail(
985 "statement-count-0-differences",982 "statement-count-0-differences",
986 text_content(u"%d" % recorder1.count))983 text_content("%d" % recorder1.count))
987 # Add some differences and render.984 # Add some differences and render.
988 add_differences(2)985 add_differences(2)
989 recorder2, batch_size = flush_and_render()986 recorder2, batch_size = flush_and_render()
990 self.addDetail(987 self.addDetail(
991 "statement-count-2-differences",988 "statement-count-2-differences",
992 text_content(u"%d" % recorder2.count))989 text_content("%d" % recorder2.count))
993 # Add more differences and render again.990 # Add more differences and render again.
994 add_differences(2)991 add_differences(2)
995 recorder3, batch_size = flush_and_render()992 recorder3, batch_size = flush_and_render()
996 self.addDetail(993 self.addDetail(
997 "statement-count-4-differences",994 "statement-count-4-differences",
998 text_content(u"%d" % recorder3.count))995 text_content("%d" % recorder3.count))
999 # The last render should not need more queries than the previous.996 # The last render should not need more queries than the previous.
1000 self.addDetail(997 self.addDetail(
1001 "statement-diff", Content(998 "statement-diff", Content(
@@ -1005,7 +1002,7 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory,
1005 (recorder3.count - recorder1.count) / float(batch_size))1002 (recorder3.count - recorder1.count) / float(batch_size))
1006 self.addDetail(1003 self.addDetail(
1007 "statement-count-per-row-average",1004 "statement-count-per-row-average",
1008 text_content(u"%.2f" % statement_count_per_row))1005 text_content("%.2f" % statement_count_per_row))
1009 # Query count is ~O(1) (i.e. not dependent of the number of1006 # Query count is ~O(1) (i.e. not dependent of the number of
1010 # differences displayed).1007 # differences displayed).
1011 self.assertThat(recorder3, HasQueryCount.byEquality(recorder2))1008 self.assertThat(recorder3, HasQueryCount.byEquality(recorder2))
@@ -1099,7 +1096,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
1099 def test_parent_packagesets_localpackagediffs_sorts(self):1096 def test_parent_packagesets_localpackagediffs_sorts(self):
1100 # Multiple packagesets are sorted in a comma separated list.1097 # Multiple packagesets are sorted in a comma separated list.
1101 ds_diff = self.factory.makeDistroSeriesDifference()1098 ds_diff = self.factory.makeDistroSeriesDifference()
1102 unsorted_names = [u"zzz", u"aaa"]1099 unsorted_names = ["zzz", "aaa"]
1103 with celebrity_logged_in('admin'):1100 with celebrity_logged_in('admin'):
1104 for name in unsorted_names:1101 for name in unsorted_names:
1105 self.factory.makePackageset(1102 self.factory.makePackageset(
@@ -1203,8 +1200,8 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
1203 rows = diff_table.tbody.find_all('tr')1200 rows = diff_table.tbody.find_all('tr')
12041201
1205 self.assertEqual(1, len(rows))1202 self.assertEqual(1, len(rows))
1206 self.assertIn("Latest comment", six.text_type(rows[0]))1203 self.assertIn("Latest comment", str(rows[0]))
1207 self.assertNotIn("Earlier comment", six.text_type(rows[0]))1204 self.assertNotIn("Earlier comment", str(rows[0]))
12081205
1209 def test_diff_row_links_to_extra_details(self):1206 def test_diff_row_links_to_extra_details(self):
1210 # The source package name links to the difference details.1207 # The source package name links to the difference details.
@@ -1227,9 +1224,9 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
1227 derived_series, parent_series = self._createChildAndParents(1224 derived_series, parent_series = self._createChildAndParents(
1228 other_parent_series=other_parent_series)1225 other_parent_series=other_parent_series)
1229 versions = {1226 versions = {
1230 'base': u'1.0',1227 'base': '1.0',
1231 'derived': u'1.0derived1',1228 'derived': '1.0derived1',
1232 'parent': u'1.0-1',1229 'parent': '1.0-1',
1233 }1230 }
12341231
1235 self.factory.makeDistroSeriesDifference(1232 self.factory.makeDistroSeriesDifference(
@@ -1264,11 +1261,11 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
1264 package_name = 'package-1'1261 package_name = 'package-1'
1265 derived_series, parent_series = self._createChildAndParent()1262 derived_series, parent_series = self._createChildAndParent()
1266 versions = {1263 versions = {
1267 'base': u'1.0',1264 'base': '1.0',
1268 'derived': u'1.0derived1',1265 'derived': '1.0derived1',
1269 'parent': u'1.0-1',1266 'parent': '1.0-1',
1270 }1267 }
1271 new_version = u'1.2'1268 new_version = '1.2'
12721269
1273 difference = self.factory.makeDistroSeriesDifference(1270 difference = self.factory.makeDistroSeriesDifference(
1274 versions=versions,1271 versions=versions,
@@ -1307,9 +1304,9 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
1307 package_name = 'package-1'1304 package_name = 'package-1'
1308 derived_series, parent_series = self._createChildAndParent()1305 derived_series, parent_series = self._createChildAndParent()
1309 versions = {1306 versions = {
1310 'base': u'1.0',1307 'base': '1.0',
1311 'derived': u'1.0derived1',1308 'derived': '1.0derived1',
1312 'parent': u'1.0-1',1309 'parent': '1.0-1',
1313 }1310 }
13141311
1315 difference = self.factory.makeDistroSeriesDifference(1312 difference = self.factory.makeDistroSeriesDifference(
@@ -1407,7 +1404,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
1407 """Enable the feature flag for derived-series upgrade."""1404 """Enable the feature flag for derived-series upgrade."""
1408 self.useFixture(1405 self.useFixture(
1409 FeatureFixture(1406 FeatureFixture(
1410 {u'soyuz.derived_series_upgrade.enabled': u'on'}))1407 {'soyuz.derived_series_upgrade.enabled': 'on'}))
14111408
1412 @with_celebrity_logged_in("admin")1409 @with_celebrity_logged_in("admin")
1413 def test_upgrades_offered_only_with_feature_flag(self):1410 def test_upgrades_offered_only_with_feature_flag(self):
@@ -1544,7 +1541,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
1544 '+localpackagediffs')1541 '+localpackagediffs')
15451542
1546 radio_title = (1543 radio_title = (
1547 u"\xa0Ignored packages with a higher version than in 'Lucid'")1544 "\xa0Ignored packages with a higher version than in 'Lucid'")
1548 radio_option_matches = soupmatchers.HTMLContains(1545 radio_option_matches = soupmatchers.HTMLContains(
1549 soupmatchers.Tag(1546 soupmatchers.Tag(
1550 "radio displays parent's name", 'label',1547 "radio displays parent's name", 'label',
@@ -1562,7 +1559,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
1562 '+localpackagediffs')1559 '+localpackagediffs')
15631560
1564 radio_title = (1561 radio_title = (
1565 u"\xa0Ignored packages with a higher version than in parent")1562 "\xa0Ignored packages with a higher version than in parent")
1566 radio_option_matches = soupmatchers.HTMLContains(1563 radio_option_matches = soupmatchers.HTMLContains(
1567 soupmatchers.Tag(1564 soupmatchers.Tag(
1568 "radio displays parent's name", 'label',1565 "radio displays parent's name", 'label',
@@ -2085,7 +2082,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
20852082
2086 # The inital state is that 1.0-1 is not in the derived series.2083 # The inital state is that 1.0-1 is not in the derived series.
2087 pubs = derived_series.main_archive.getPublishedSources(2084 pubs = derived_series.main_archive.getPublishedSources(
2088 name=u'my-src-name', version=versions['parent'],2085 name='my-src-name', version=versions['parent'],
2089 distroseries=derived_series).any()2086 distroseries=derived_series).any()
2090 self.assertIs(None, pubs)2087 self.assertIs(None, pubs)
20912088
@@ -2144,7 +2141,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
2144 self._syncAndGetView(2141 self._syncAndGetView(
2145 derived_series, person, [diff_id])2142 derived_series, person, [diff_id])
2146 parent_series.main_archive.getPublishedSources(2143 parent_series.main_archive.getPublishedSources(
2147 name=u'my-src-name', version=versions['parent'],2144 name='my-src-name', version=versions['parent'],
2148 distroseries=parent_series).one()2145 distroseries=parent_series).one()
21492146
2150 # We look for a PackageCopyJob with the right metadata.2147 # We look for a PackageCopyJob with the right metadata.
@@ -2274,7 +2271,7 @@ class TestCopyAsynchronouslyMessage(TestCaseWithFactory):
2274 layer = DatabaseFunctionalLayer2271 layer = DatabaseFunctionalLayer
22752272
2276 def setUp(self):2273 def setUp(self):
2277 super(TestCopyAsynchronouslyMessage, self).setUp()2274 super().setUp()
2278 self.archive = self.factory.makeArchive()2275 self.archive = self.factory.makeArchive()
2279 self.series = self.factory.makeDistroSeries()2276 self.series = self.factory.makeDistroSeries()
2280 self.series_url = canonical_url(self.series)2277 self.series_url = canonical_url(self.series)
@@ -2388,8 +2385,7 @@ class DistroSeriesMissingPackagesPageTestCase(TestCaseWithFactory,
2388 layer = LaunchpadFunctionalLayer2385 layer = LaunchpadFunctionalLayer
23892386
2390 def setUp(self):2387 def setUp(self):
2391 super(DistroSeriesMissingPackagesPageTestCase,2388 super().setUp('foo.bar@canonical.com')
2392 self).setUp('foo.bar@canonical.com')
2393 self.simple_user = self.factory.makePerson()2389 self.simple_user = self.factory.makePerson()
23942390
2395 def test_parent_packagesets_missingpackages(self):2391 def test_parent_packagesets_missingpackages(self):
@@ -2552,8 +2548,7 @@ class DistroSeriesUniquePackagesPageTestCase(TestCaseWithFactory,
2552 layer = DatabaseFunctionalLayer2548 layer = DatabaseFunctionalLayer
25532549
2554 def setUp(self):2550 def setUp(self):
2555 super(DistroSeriesUniquePackagesPageTestCase,2551 super().setUp('foo.bar@canonical.com')
2556 self).setUp('foo.bar@canonical.com')
2557 self.simple_user = self.factory.makePerson()2552 self.simple_user = self.factory.makePerson()
25582553
2559 def test_packagesets_uniquepackages(self):2554 def test_packagesets_uniquepackages(self):
diff --git a/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py b/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py
index 766caac..ea2e246 100644
--- a/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py
+++ b/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py
@@ -108,8 +108,8 @@ class DistroSeriesDifferenceTestCase(TestCaseWithFactory):
108108
109 self.assertIsNot(None, view.binary_summaries)109 self.assertIsNot(None, view.binary_summaries)
110 self.assertEqual([110 self.assertEqual([
111 u'flubber-bin: summary for flubber-bin',111 'flubber-bin: summary for flubber-bin',
112 u'flubber-lib: summary for flubber-lib',112 'flubber-lib: summary for flubber-lib',
113 ], view.binary_summaries)113 ], view.binary_summaries)
114114
115 def test_binary_summaries_for_missing_difference(self):115 def test_binary_summaries_for_missing_difference(self):
@@ -124,8 +124,8 @@ class DistroSeriesDifferenceTestCase(TestCaseWithFactory):
124124
125 self.assertIsNot(None, view.binary_summaries)125 self.assertIsNot(None, view.binary_summaries)
126 self.assertEqual([126 self.assertEqual([
127 u'flubber-bin: summary for flubber-bin',127 'flubber-bin: summary for flubber-bin',
128 u'flubber-lib: summary for flubber-lib',128 'flubber-lib: summary for flubber-lib',
129 ], view.binary_summaries)129 ], view.binary_summaries)
130130
131 def test_binary_summaries_no_pubs(self):131 def test_binary_summaries_no_pubs(self):
diff --git a/lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py b/lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py
index 79a74d4..58941cc 100644
--- a/lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py
+++ b/lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py
@@ -179,40 +179,40 @@ class DistroSeriesDifferenceWebServiceTestCase(TestCaseWithFactory):
179 ws_diff = ws_object(self.factory.makeLaunchpadService(179 ws_diff = ws_object(self.factory.makeLaunchpadService(
180 self.factory.makePerson()), ds_diff)180 self.factory.makePerson()), ds_diff)
181181
182 self.assertEqual(u'Blocklisted always', ws_diff.status)182 self.assertEqual('Blocklisted always', ws_diff.status)
183183
184 def test_exported_sourcepackagename(self):184 def test_exported_sourcepackagename(self):
185 # The difference's sourcepackagename is exposed.185 # The difference's sourcepackagename is exposed.
186 ds_diff = self.factory.makeDistroSeriesDifference(186 ds_diff = self.factory.makeDistroSeriesDifference(
187 source_package_name_str=u'package')187 source_package_name_str='package')
188 ws_diff = ws_object(self.factory.makeLaunchpadService(188 ws_diff = ws_object(self.factory.makeLaunchpadService(
189 self.factory.makePerson()), ds_diff)189 self.factory.makePerson()), ds_diff)
190190
191 self.assertEqual(u'package', ws_diff.sourcepackagename)191 self.assertEqual('package', ws_diff.sourcepackagename)
192192
193 def test_exported_parent_source_version(self):193 def test_exported_parent_source_version(self):
194 # The difference's parent_source_version is exposed.194 # The difference's parent_source_version is exposed.
195 ds_diff = self.factory.makeDistroSeriesDifference(195 ds_diff = self.factory.makeDistroSeriesDifference(
196 versions={'parent': u'1.1'})196 versions={'parent': '1.1'})
197 ws_diff = ws_object(self.factory.makeLaunchpadService(197 ws_diff = ws_object(self.factory.makeLaunchpadService(
198 self.factory.makePerson()), ds_diff)198 self.factory.makePerson()), ds_diff)
199199
200 self.assertEqual(u'1.1', ws_diff.parent_source_version)200 self.assertEqual('1.1', ws_diff.parent_source_version)
201201
202 def test_exported_source_version(self):202 def test_exported_source_version(self):
203 # The difference's source_version is exposed.203 # The difference's source_version is exposed.
204 ds_diff = self.factory.makeDistroSeriesDifference(204 ds_diff = self.factory.makeDistroSeriesDifference(
205 versions={'derived': u'1.3'})205 versions={'derived': '1.3'})
206 ws_diff = ws_object(self.factory.makeLaunchpadService(206 ws_diff = ws_object(self.factory.makeLaunchpadService(
207 self.factory.makePerson()), ds_diff)207 self.factory.makePerson()), ds_diff)
208208
209 self.assertEqual(u'1.3', ws_diff.source_version)209 self.assertEqual('1.3', ws_diff.source_version)
210210
211 def test_exported_base_version(self):211 def test_exported_base_version(self):
212 # The difference's base_version is exposed.212 # The difference's base_version is exposed.
213 ds_diff = self.factory.makeDistroSeriesDifference(213 ds_diff = self.factory.makeDistroSeriesDifference(
214 versions={'base': u'0.5'}, set_base_version=True)214 versions={'base': '0.5'}, set_base_version=True)
215 ws_diff = ws_object(self.factory.makeLaunchpadService(215 ws_diff = ws_object(self.factory.makeLaunchpadService(
216 self.factory.makePerson()), ds_diff)216 self.factory.makePerson()), ds_diff)
217217
218 self.assertEqual(u'0.5', ws_diff.base_version)218 self.assertEqual('0.5', ws_diff.base_version)
diff --git a/lib/lp/registry/browser/tests/test_edit_permissions.py b/lib/lp/registry/browser/tests/test_edit_permissions.py
index 022daa5..7e41b28 100644
--- a/lib/lp/registry/browser/tests/test_edit_permissions.py
+++ b/lib/lp/registry/browser/tests/test_edit_permissions.py
@@ -28,7 +28,7 @@ class EditViewPermissionBase(TestCaseWithFactory):
28 layer = DatabaseFunctionalLayer28 layer = DatabaseFunctionalLayer
2929
30 def setUp(self):30 def setUp(self):
31 super(EditViewPermissionBase, self).setUp()31 super().setUp()
32 self.setupTarget()32 self.setupTarget()
33 self.registry_admin = self.factory.makePerson(name='registry-admin')33 self.registry_admin = self.factory.makePerson(name='registry-admin')
34 celebs = getUtility(ILaunchpadCelebrities)34 celebs = getUtility(ILaunchpadCelebrities)
diff --git a/lib/lp/registry/browser/tests/test_mailinglists.py b/lib/lp/registry/browser/tests/test_mailinglists.py
index b1154ba..004eb71 100644
--- a/lib/lp/registry/browser/tests/test_mailinglists.py
+++ b/lib/lp/registry/browser/tests/test_mailinglists.py
@@ -68,7 +68,7 @@ class MailingListSubscriptionControlsTestCase(TestCaseWithFactory):
68 layer = DatabaseFunctionalLayer68 layer = DatabaseFunctionalLayer
6969
70 def setUp(self):70 def setUp(self):
71 super(MailingListSubscriptionControlsTestCase, self).setUp()71 super().setUp()
72 self.a_team = self.factory.makeTeam(name='a')72 self.a_team = self.factory.makeTeam(name='a')
73 self.b_team = self.factory.makeTeam(name='b', owner=self.a_team)73 self.b_team = self.factory.makeTeam(name='b', owner=self.a_team)
74 self.b_team_list = self.factory.makeMailingList(team=self.b_team,74 self.b_team_list = self.factory.makeMailingList(team=self.b_team,
diff --git a/lib/lp/registry/browser/tests/test_milestone.py b/lib/lp/registry/browser/tests/test_milestone.py
index e56ac8b..f5c22f6 100644
--- a/lib/lp/registry/browser/tests/test_milestone.py
+++ b/lib/lp/registry/browser/tests/test_milestone.py
@@ -156,7 +156,7 @@ class TestAddMilestoneViews(TestCaseWithFactory):
156 layer = DatabaseFunctionalLayer156 layer = DatabaseFunctionalLayer
157157
158 def setUp(self):158 def setUp(self):
159 super(TestAddMilestoneViews, self).setUp()159 super().setUp()
160 self.product = self.factory.makeProduct()160 self.product = self.factory.makeProduct()
161 self.series = self.factory.makeProductSeries(product=self.product)161 self.series = self.factory.makeProductSeries(product=self.product)
162 self.owner = self.product.owner162 self.owner = self.product.owner
@@ -196,7 +196,7 @@ class TestAddMilestoneViews(TestCaseWithFactory):
196 self.assertEqual(expected_msg, error_msg)196 self.assertEqual(expected_msg, error_msg)
197197
198 def test_add_milestone_with_tags(self):198 def test_add_milestone_with_tags(self):
199 tags = u'zed alpha'199 tags = 'zed alpha'
200 form = {200 form = {
201 'field.name': '1.1',201 'field.name': '1.1',
202 'field.tags': tags,202 'field.tags': tags,
@@ -222,7 +222,7 @@ class TestMilestoneEditView(TestCaseWithFactory):
222 layer = DatabaseFunctionalLayer222 layer = DatabaseFunctionalLayer
223223
224 def setUp(self):224 def setUp(self):
225 super(TestMilestoneEditView, self).setUp()225 super().setUp()
226 self.product = self.factory.makeProduct()226 self.product = self.factory.makeProduct()
227 self.milestone = self.factory.makeMilestone(227 self.milestone = self.factory.makeMilestone(
228 name='orig-name', product=self.product)228 name='orig-name', product=self.product)
@@ -230,9 +230,9 @@ class TestMilestoneEditView(TestCaseWithFactory):
230 login_person(self.owner)230 login_person(self.owner)
231231
232 def test_edit_milestone_with_tags(self):232 def test_edit_milestone_with_tags(self):
233 orig_tags = u'ba ac'233 orig_tags = 'ba ac'
234 self.milestone.setTags(orig_tags.split(), self.owner)234 self.milestone.setTags(orig_tags.split(), self.owner)
235 new_tags = u'za ab'235 new_tags = 'za ab'
236 form = {236 form = {
237 'field.name': 'new-name',237 'field.name': 'new-name',
238 'field.tags': new_tags,238 'field.tags': new_tags,
@@ -245,7 +245,7 @@ class TestMilestoneEditView(TestCaseWithFactory):
245 self.assertEqual(expected, self.milestone.getTags())245 self.assertEqual(expected, self.milestone.getTags())
246246
247 def test_edit_milestone_clear_tags(self):247 def test_edit_milestone_clear_tags(self):
248 orig_tags = u'ba ac'248 orig_tags = 'ba ac'
249 self.milestone.setTags(orig_tags.split(), self.owner)249 self.milestone.setTags(orig_tags.split(), self.owner)
250 form = {250 form = {
251 'field.name': 'new-name',251 'field.name': 'new-name',
@@ -365,7 +365,7 @@ class TestProjectMilestoneIndexQueryCount(TestQueryCountBase):
365 layer = DatabaseFunctionalLayer365 layer = DatabaseFunctionalLayer
366366
367 def setUp(self):367 def setUp(self):
368 super(TestProjectMilestoneIndexQueryCount, self).setUp()368 super().setUp()
369 self.owner = self.factory.makePerson(name='product-owner')369 self.owner = self.factory.makePerson(name='product-owner')
370 self.product = self.factory.makeProduct(owner=self.owner)370 self.product = self.factory.makeProduct(owner=self.owner)
371 self.product_owner = self.product.owner371 self.product_owner = self.product.owner
@@ -481,7 +481,7 @@ class TestProjectGroupMilestoneIndexQueryCount(TestQueryCountBase):
481 layer = DatabaseFunctionalLayer481 layer = DatabaseFunctionalLayer
482482
483 def setUp(self):483 def setUp(self):
484 super(TestProjectGroupMilestoneIndexQueryCount, self).setUp()484 super().setUp()
485 self.owner = self.factory.makePerson(name='product-owner')485 self.owner = self.factory.makePerson(name='product-owner')
486 self.project_group = self.factory.makeProject(owner=self.owner)486 self.project_group = self.factory.makeProject(owner=self.owner)
487 login_person(self.owner)487 login_person(self.owner)
@@ -539,7 +539,7 @@ class TestDistributionMilestoneIndexQueryCount(TestQueryCountBase):
539 layer = DatabaseFunctionalLayer539 layer = DatabaseFunctionalLayer
540540
541 def setUp(self):541 def setUp(self):
542 super(TestDistributionMilestoneIndexQueryCount, self).setUp()542 super().setUp()
543 self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu543 self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
544 self.owner = self.factory.makePerson(name='test-owner')544 self.owner = self.factory.makePerson(name='test-owner')
545 login_team(self.ubuntu.owner)545 login_team(self.ubuntu.owner)
@@ -597,8 +597,8 @@ class TestMilestoneTagView(TestQueryCountBase):
597 layer = DatabaseFunctionalLayer597 layer = DatabaseFunctionalLayer
598598
599 def setUp(self):599 def setUp(self):
600 super(TestMilestoneTagView, self).setUp()600 super().setUp()
601 self.tags = [u'tag1']601 self.tags = ['tag1']
602 self.owner = self.factory.makePerson()602 self.owner = self.factory.makePerson()
603 self.project_group = self.factory.makeProject(owner=self.owner)603 self.project_group = self.factory.makeProject(owner=self.owner)
604 self.product = self.factory.makeProduct(604 self.product = self.factory.makeProduct(
@@ -620,8 +620,8 @@ class TestMilestoneTagView(TestQueryCountBase):
620620
621 def _make_form(self, tags):621 def _make_form(self, tags):
622 return {622 return {
623 u'field.actions.search': u'Search',623 'field.actions.search': 'Search',
624 u'field.tags': u' '.join(tags),624 'field.tags': ' '.join(tags),
625 }625 }
626626
627 def _url_tail(self, url, separator='/'):627 def _url_tail(self, url, separator='/'):
@@ -636,7 +636,7 @@ class TestMilestoneTagView(TestQueryCountBase):
636636
637 def test_view_form_redirect(self):637 def test_view_form_redirect(self):
638 # Ensure a correct redirection is performed when tags are searched.638 # Ensure a correct redirection is performed when tags are searched.
639 tags = [u'tag1', u'tag2']639 tags = ['tag1', 'tag2']
640 form = self._make_form(tags)640 form = self._make_form(tags)
641 view = create_initialized_view(self.milestonetag, '+index', form=form)641 view = create_initialized_view(self.milestonetag, '+index', form=form)
642 self.assertEqual(302, view.request.response.getStatus())642 self.assertEqual(302, view.request.response.getStatus())
@@ -648,7 +648,7 @@ class TestMilestoneTagView(TestQueryCountBase):
648648
649 def test_view_form_error(self):649 def test_view_form_error(self):
650 # Ensure the form correctly handles invalid submissions.650 # Ensure the form correctly handles invalid submissions.
651 tags = [u'tag1', u't'] # One char tag is not valid.651 tags = ['tag1', 't'] # One char tag is not valid.
652 form = self._make_form(tags)652 form = self._make_form(tags)
653 view = create_initialized_view(self.milestonetag, '+index', form=form)653 view = create_initialized_view(self.milestonetag, '+index', form=form)
654 self.assertEqual(1, len(view.errors))654 self.assertEqual(1, len(view.errors))
diff --git a/lib/lp/registry/browser/tests/test_ociproject.py b/lib/lp/registry/browser/tests/test_ociproject.py
index 4557d1d..05babda 100644
--- a/lib/lp/registry/browser/tests/test_ociproject.py
+++ b/lib/lp/registry/browser/tests/test_ociproject.py
@@ -85,7 +85,7 @@ class TestOCIProjectView(OCIConfigHelperMixin, BrowserTestCase):
85 layer = DatabaseFunctionalLayer85 layer = DatabaseFunctionalLayer
8686
87 def setUp(self):87 def setUp(self):
88 super(TestOCIProjectView, self).setUp()88 super().setUp()
89 self.setConfig()89 self.setConfig()
9090
91 def test_facet_top_links(self):91 def test_facet_top_links(self):
diff --git a/lib/lp/registry/browser/tests/test_packaging.py b/lib/lp/registry/browser/tests/test_packaging.py
index 35ffc0c..770ff37 100644
--- a/lib/lp/registry/browser/tests/test_packaging.py
+++ b/lib/lp/registry/browser/tests/test_packaging.py
@@ -36,12 +36,12 @@ class TestProductSeriesUbuntuPackagingView(WithScenarios, TestCaseWithFactory):
36 scenarios = [36 scenarios = [
37 ("spn_picker", {"features": {}}),37 ("spn_picker", {"features": {}}),
38 ("dsp_picker", {38 ("dsp_picker", {
39 "features": {u"disclosure.dsp_picker.enabled": u"on"},39 "features": {"disclosure.dsp_picker.enabled": "on"},
40 }),40 }),
41 ]41 ]
4242
43 def setUp(self):43 def setUp(self):
44 super(TestProductSeriesUbuntuPackagingView, self).setUp()44 super().setUp()
45 if self.features:45 if self.features:
46 self.useFixture(FeatureFixture(self.features))46 self.useFixture(FeatureFixture(self.features))
47 self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu47 self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
@@ -150,7 +150,7 @@ class TestBrowserDeletePackaging(TestCaseWithFactory):
150 layer = DatabaseFunctionalLayer150 layer = DatabaseFunctionalLayer
151151
152 def setUp(self):152 def setUp(self):
153 super(TestBrowserDeletePackaging, self).setUp()153 super().setUp()
154 # Only the person which created the packaging, admins154 # Only the person which created the packaging, admins
155 # and other people with certain privileges can delete a155 # and other people with certain privileges can delete a
156 # packaging. Since the sample data record we'll use for156 # packaging. Since the sample data record we'll use for
diff --git a/lib/lp/registry/browser/tests/test_peoplemerge.py b/lib/lp/registry/browser/tests/test_peoplemerge.py
index aa359fd..939e432 100644
--- a/lib/lp/registry/browser/tests/test_peoplemerge.py
+++ b/lib/lp/registry/browser/tests/test_peoplemerge.py
@@ -37,13 +37,13 @@ from lp.testing.views import (
37class RequestPeopleMergeMixin(TestCaseWithFactory):37class RequestPeopleMergeMixin(TestCaseWithFactory):
3838
39 def setUp(self):39 def setUp(self):
40 super(RequestPeopleMergeMixin, self).setUp()40 super().setUp()
41 self.person_set = getUtility(IPersonSet)41 self.person_set = getUtility(IPersonSet)
42 self.dupe = self.factory.makePerson(42 self.dupe = self.factory.makePerson(
43 name='foo', email='foo@baz.com')43 name='foo', email='foo@baz.com')
4444
45 def tearDown(self):45 def tearDown(self):
46 super(RequestPeopleMergeMixin, self).tearDown()46 super().tearDown()
47 stub.test_emails = []47 stub.test_emails = []
4848
4949
@@ -53,7 +53,7 @@ class TestRequestPeopleMergeMultipleEmails(RequestPeopleMergeMixin):
53 layer = DatabaseFunctionalLayer53 layer = DatabaseFunctionalLayer
5454
55 def setUp(self):55 def setUp(self):
56 super(TestRequestPeopleMergeMultipleEmails, self).setUp()56 super().setUp()
57 EmailAddressSet().new(57 EmailAddressSet().new(
58 'bar.foo@canonical.com', person=self.dupe,58 'bar.foo@canonical.com', person=self.dupe,
59 status=EmailAddressStatus.VALIDATED)59 status=EmailAddressStatus.VALIDATED)
@@ -72,8 +72,8 @@ class TestRequestPeopleMergeMultipleEmails(RequestPeopleMergeMixin):
72 explanation = find_tag_by_id(browser.contents, 'explanation')72 explanation = find_tag_by_id(browser.contents, 'explanation')
73 self.assertThat(73 self.assertThat(
74 extract_text(explanation), DocTestMatches(74 extract_text(explanation), DocTestMatches(
75 u"The account..."75 "The account..."
76 u"has more than one registered email address..."))76 "has more than one registered email address..."))
77 email_select_control = browser.getControl(name='selected')77 email_select_control = browser.getControl(name='selected')
78 for ctrl in email_select_control.controls:78 for ctrl in email_select_control.controls:
79 ctrl.selected = True79 ctrl.selected = True
@@ -213,7 +213,7 @@ class TestRequestPeopleMergeHiddenEmailAddresses(RequestPeopleMergeMixin):
213 layer = DatabaseFunctionalLayer213 layer = DatabaseFunctionalLayer
214214
215 def setUp(self):215 def setUp(self):
216 super(TestRequestPeopleMergeHiddenEmailAddresses, self).setUp()216 super().setUp()
217 removeSecurityProxy(self.dupe).hide_email_addresses = True217 removeSecurityProxy(self.dupe).hide_email_addresses = True
218 EmailAddressSet().new(218 EmailAddressSet().new(
219 'bar.foo@canonical.com', person=self.dupe,219 'bar.foo@canonical.com', person=self.dupe,
@@ -257,7 +257,7 @@ class TestValidatingMergeView(TestCaseWithFactory):
257 layer = DatabaseFunctionalLayer257 layer = DatabaseFunctionalLayer
258258
259 def setUp(self):259 def setUp(self):
260 super(TestValidatingMergeView, self).setUp()260 super().setUp()
261 self.person_set = getUtility(IPersonSet)261 self.person_set = getUtility(IPersonSet)
262 self.dupe = self.factory.makePerson(name='dupe')262 self.dupe = self.factory.makePerson(name='dupe')
263 self.target = self.factory.makePerson(name='target')263 self.target = self.factory.makePerson(name='target')
@@ -281,7 +281,7 @@ class TestValidatingMergeView(TestCaseWithFactory):
281 self.person_set, '+requestmerge', form=self.getForm())281 self.person_set, '+requestmerge', form=self.getForm())
282 self.assertEqual(282 self.assertEqual(
283 [html_escape(283 [html_escape(
284 u"dupe has a PPA that must be deleted before it can be "284 "dupe has a PPA that must be deleted before it can be "
285 "merged. It may take ten minutes to remove the deleted PPA's "285 "merged. It may take ten minutes to remove the deleted PPA's "
286 "files.")],286 "files.")],
287 view.errors)287 view.errors)
@@ -294,7 +294,7 @@ class TestValidatingMergeView(TestCaseWithFactory):
294 view = create_initialized_view(294 view = create_initialized_view(
295 self.person_set, '+requestmerge', form=self.getForm())295 self.person_set, '+requestmerge', form=self.getForm())
296 self.assertEqual(296 self.assertEqual(
297 [u"dupe owns private branches that must be deleted or "297 ["dupe owns private branches that must be deleted or "
298 "transferred to another owner first."],298 "transferred to another owner first."],
299 view.errors)299 view.errors)
300300
@@ -306,7 +306,7 @@ class TestValidatingMergeView(TestCaseWithFactory):
306 view = create_initialized_view(306 view = create_initialized_view(
307 self.person_set, '+requestmerge', form=self.getForm())307 self.person_set, '+requestmerge', form=self.getForm())
308 self.assertEqual(308 self.assertEqual(
309 [u"dupe owns private Git repositories that must be deleted or "309 ["dupe owns private Git repositories that must be deleted or "
310 "transferred to another owner first."],310 "transferred to another owner first."],
311 view.errors)311 view.errors)
312312
@@ -352,7 +352,7 @@ class TestRequestPeopleMergeMultipleEmailsView(TestCaseWithFactory):
352 layer = DatabaseFunctionalLayer352 layer = DatabaseFunctionalLayer
353353
354 def setUp(self):354 def setUp(self):
355 super(TestRequestPeopleMergeMultipleEmailsView, self).setUp()355 super().setUp()
356 self.personset = getUtility(IPersonSet)356 self.personset = getUtility(IPersonSet)
357 self.dupe_user = self.factory.makePerson()357 self.dupe_user = self.factory.makePerson()
358 self.email_2 = self.factory.makeEmail(358 self.email_2 = self.factory.makeEmail(
@@ -409,7 +409,7 @@ class TestAdminTeamMergeView(TestCaseWithFactory):
409 layer = DatabaseFunctionalLayer409 layer = DatabaseFunctionalLayer
410410
411 def setUp(self):411 def setUp(self):
412 super(TestAdminTeamMergeView, self).setUp()412 super().setUp()
413 self.person_set = getUtility(IPersonSet)413 self.person_set = getUtility(IPersonSet)
414 self.dupe_team = self.factory.makeTeam(name='dupe-team')414 self.dupe_team = self.factory.makeTeam(name='dupe-team')
415 self.target_team = self.factory.makeTeam(name='target-team')415 self.target_team = self.factory.makeTeam(name='target-team')
@@ -434,7 +434,7 @@ class TestAdminTeamMergeView(TestCaseWithFactory):
434 view = self.getView()434 view = self.getView()
435 self.assertEqual(435 self.assertEqual(
436 [html_escape(436 [html_escape(
437 u"dupe-team has a PPA that must be deleted before it can be "437 "dupe-team has a PPA that must be deleted before it can be "
438 "merged. It may take ten minutes to remove the deleted PPA's "438 "merged. It may take ten minutes to remove the deleted PPA's "
439 "files.")],439 "files.")],
440 view.errors)440 view.errors)
@@ -446,7 +446,7 @@ class TestAdminPeopleMergeView(TestCaseWithFactory):
446 layer = DatabaseFunctionalLayer446 layer = DatabaseFunctionalLayer
447447
448 def setUp(self):448 def setUp(self):
449 super(TestAdminPeopleMergeView, self).setUp()449 super().setUp()
450 self.person_set = getUtility(IPersonSet)450 self.person_set = getUtility(IPersonSet)
451 self.dupe_person = self.factory.makePerson(name='dupe-person')451 self.dupe_person = self.factory.makePerson(name='dupe-person')
452 self.target_person = self.factory.makePerson()452 self.target_person = self.factory.makePerson()
@@ -470,7 +470,7 @@ class TestAdminPeopleMergeView(TestCaseWithFactory):
470 view = self.getView()470 view = self.getView()
471 self.assertEqual(471 self.assertEqual(
472 [html_escape(472 [html_escape(
473 u"dupe-person has a PPA that must be deleted before it can "473 "dupe-person has a PPA that must be deleted before it can "
474 "be merged. It may take ten minutes to remove the deleted "474 "be merged. It may take ten minutes to remove the deleted "
475 "PPA's files.")],475 "PPA's files.")],
476 view.errors)476 view.errors)
diff --git a/lib/lp/registry/browser/tests/test_person.py b/lib/lp/registry/browser/tests/test_person.py
index bed2125..1a1624f 100644
--- a/lib/lp/registry/browser/tests/test_person.py
+++ b/lib/lp/registry/browser/tests/test_person.py
@@ -593,7 +593,7 @@ class TestPersonViewKarma(TestCaseWithFactory):
593 layer = LaunchpadZopelessLayer593 layer = LaunchpadZopelessLayer
594594
595 def setUp(self):595 def setUp(self):
596 super(TestPersonViewKarma, self).setUp()596 super().setUp()
597 person = self.factory.makePerson()597 person = self.factory.makePerson()
598 product = self.factory.makeProduct()598 product = self.factory.makeProduct()
599 transaction.commit()599 transaction.commit()
@@ -612,7 +612,7 @@ class TestPersonViewKarma(TestCaseWithFactory):
612 for category in categories:612 for category in categories:
613 category_names.append(category.name)613 category_names.append(category.name)
614614
615 self.assertEqual(category_names, [u'code', u'bugs', u'answers'],615 self.assertEqual(category_names, ['code', 'bugs', 'answers'],
616 'Categories are not sorted correctly')616 'Categories are not sorted correctly')
617617
618 def _makeKarmaCache(self, person, product, category, value=10):618 def _makeKarmaCache(self, person, product, category, value=10):
@@ -781,7 +781,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
781 layer = LaunchpadFunctionalLayer781 layer = LaunchpadFunctionalLayer
782782
783 def setUp(self):783 def setUp(self):
784 super(TestPersonEditView, self).setUp()784 super().setUp()
785 self.valid_email_address = self.factory.getUniqueEmailAddress()785 self.valid_email_address = self.factory.getUniqueEmailAddress()
786 self.person = self.factory.makePerson(email=self.valid_email_address)786 self.person = self.factory.makePerson(email=self.valid_email_address)
787 login_person(self.person)787 login_person(self.person)
@@ -846,7 +846,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
846 """Special assert function for dealing with email-related errors."""846 """Special assert function for dealing with email-related errors."""
847 view = self.createAddEmailView(email_str)847 view = self.createAddEmailView(email_str)
848 error_msg = view.errors[0]848 error_msg = view.errors[0]
849 if not isinstance(error_msg, six.text_type):849 if not isinstance(error_msg, str):
850 error_msg = error_msg.doc()850 error_msg = error_msg.doc()
851 self.assertEqual(expected_msg, error_msg)851 self.assertEqual(expected_msg, error_msg)
852852
@@ -865,7 +865,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
865 notifications = view.request.response.notifications865 notifications = view.request.response.notifications
866 self.assertEqual(1, len(notifications))866 self.assertEqual(1, len(notifications))
867 expected_msg = html_escape(867 expected_msg = html_escape(
868 u"A confirmation message has been sent to '%s'."868 "A confirmation message has been sent to '%s'."
869 " Follow the instructions in that message to confirm"869 " Follow the instructions in that message to confirm"
870 " that the address is yours. (If the message doesn't arrive in a"870 " that the address is yours. (If the message doesn't arrive in a"
871 " few minutes, your mail provider might use 'greylisting', which"871 " few minutes, your mail provider might use 'greylisting', which"
@@ -911,7 +911,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
911 notifications = view.request.response.notifications911 notifications = view.request.response.notifications
912 self.assertEqual(1, len(notifications))912 self.assertEqual(1, len(notifications))
913 expected_msg = html_escape(913 expected_msg = html_escape(
914 u"An email message was sent to '%s' "914 "An email message was sent to '%s' "
915 "with instructions on how to confirm that it belongs to you."915 "with instructions on how to confirm that it belongs to you."
916 % added_email)916 % added_email)
917 self.assertEqual(expected_msg, notifications[0].message)917 self.assertEqual(expected_msg, notifications[0].message)
@@ -941,12 +941,12 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
941 token_url = get_token_url_from_email(raw_msg)941 token_url = get_token_url_from_email(raw_msg)
942 browser = setupBrowserForUser(user=self.person)942 browser = setupBrowserForUser(user=self.person)
943 browser.open(token_url)943 browser.open(token_url)
944 expected_msg = u'Confirm email address <code>%s</code>' % added_email944 expected_msg = 'Confirm email address <code>%s</code>' % added_email
945 self.assertIn(expected_msg, browser.contents)945 self.assertIn(expected_msg, browser.contents)
946 browser.getControl('Continue').click()946 browser.getControl('Continue').click()
947 # Login again to access displayname, since browser logged us out.947 # Login again to access displayname, since browser logged us out.
948 login_person(self.person)948 login_person(self.person)
949 expected_title = u'%s in Launchpad' % self.person.displayname949 expected_title = '%s in Launchpad' % self.person.displayname
950 self.assertEqual(expected_title, browser.title)950 self.assertEqual(expected_title, browser.title)
951951
952 def test_remove_unvalidated_email_address(self):952 def test_remove_unvalidated_email_address(self):
@@ -961,7 +961,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
961 notifications = view.request.response.notifications961 notifications = view.request.response.notifications
962 self.assertEqual(1, len(notifications))962 self.assertEqual(1, len(notifications))
963 expected_msg = html_escape(963 expected_msg = html_escape(
964 u"The email address '%s' has been removed." % added_email)964 "The email address '%s' has been removed." % added_email)
965 self.assertEqual(expected_msg, notifications[0].message)965 self.assertEqual(expected_msg, notifications[0].message)
966966
967 def test_cannot_remove_contact_address(self):967 def test_cannot_remove_contact_address(self):
@@ -990,7 +990,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
990 notifications = view.request.response.notifications990 notifications = view.request.response.notifications
991 self.assertEqual(1, len(notifications))991 self.assertEqual(1, len(notifications))
992 expected_msg = (992 expected_msg = (
993 u"Your contact address has been changed to: %s" % added_email)993 "Your contact address has been changed to: %s" % added_email)
994 self.assertEqual(expected_msg, notifications[0].message)994 self.assertEqual(expected_msg, notifications[0].message)
995995
996 def test_set_contact_address_already_set(self):996 def test_set_contact_address_already_set(self):
@@ -1022,21 +1022,21 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
1022 def test_email_string_validation_no_email_prodvided(self):1022 def test_email_string_validation_no_email_prodvided(self):
1023 """+editemails should warn if no email is provided."""1023 """+editemails should warn if no email is provided."""
1024 no_email = ''1024 no_email = ''
1025 expected_msg = u'Required input is missing.'1025 expected_msg = 'Required input is missing.'
1026 self._assertEmailAndError(no_email, expected_msg)1026 self._assertEmailAndError(no_email, expected_msg)
10271027
1028 def test_email_string_validation_invalid_email(self):1028 def test_email_string_validation_invalid_email(self):
1029 """+editemails should warn when provided data is not an email."""1029 """+editemails should warn when provided data is not an email."""
1030 not_an_email = 'foo'1030 not_an_email = 'foo'
1031 expected_msg = html_escape(1031 expected_msg = html_escape(
1032 u"'foo' doesn't seem to be a valid email address.")1032 "'foo' doesn't seem to be a valid email address.")
1033 self._assertEmailAndError(not_an_email, expected_msg)1033 self._assertEmailAndError(not_an_email, expected_msg)
10341034
1035 def test_email_string_validation_is_escaped(self):1035 def test_email_string_validation_is_escaped(self):
1036 """+editemails should escape output to prevent XSS."""1036 """+editemails should escape output to prevent XSS."""
1037 xss_email = "foo@example.com<script>window.alert('XSS')</script>"1037 xss_email = "foo@example.com<script>window.alert('XSS')</script>"
1038 expected_msg = (1038 expected_msg = (
1039 u"&#x27;foo@example.com&lt;script&gt;"1039 "&#x27;foo@example.com&lt;script&gt;"
1040 "window.alert(&#x27;XSS&#x27;)&lt;/script&gt;&#x27;"1040 "window.alert(&#x27;XSS&#x27;)&lt;/script&gt;&#x27;"
1041 " doesn&#x27;t seem to be a valid email address.")1041 " doesn&#x27;t seem to be a valid email address.")
1042 self._assertEmailAndError(xss_email, expected_msg)1042 self._assertEmailAndError(xss_email, expected_msg)
@@ -1056,7 +1056,7 @@ class TestPersonParticipationView(TestCaseWithFactory):
1056 layer = DatabaseFunctionalLayer1056 layer = DatabaseFunctionalLayer
10571057
1058 def setUp(self):1058 def setUp(self):
1059 super(TestPersonParticipationView, self).setUp()1059 super().setUp()
1060 self.user = self.factory.makePerson()1060 self.user = self.factory.makePerson()
1061 self.view = create_view(self.user, name='+participation')1061 self.view = create_view(self.user, name='+participation')
10621062
@@ -1234,7 +1234,7 @@ class TestPersonRelatedPackagesView(TestCaseWithFactory):
1234 layer = LaunchpadFunctionalLayer1234 layer = LaunchpadFunctionalLayer
12351235
1236 def setUp(self):1236 def setUp(self):
1237 super(TestPersonRelatedPackagesView, self).setUp()1237 super().setUp()
1238 self.user = self.factory.makePerson()1238 self.user = self.factory.makePerson()
1239 self.factory.makeGPGKey(self.user)1239 self.factory.makeGPGKey(self.user)
1240 self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu1240 self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
@@ -1328,7 +1328,7 @@ class TestPersonMaintainedPackagesView(TestCaseWithFactory):
1328 layer = DatabaseFunctionalLayer1328 layer = DatabaseFunctionalLayer
13291329
1330 def setUp(self):1330 def setUp(self):
1331 super(TestPersonMaintainedPackagesView, self).setUp()1331 super().setUp()
1332 self.user = self.factory.makePerson()1332 self.user = self.factory.makePerson()
1333 self.view = create_initialized_view(self.user, '+maintained-packages')1333 self.view = create_initialized_view(self.user, '+maintained-packages')
13341334
@@ -1347,7 +1347,7 @@ class TestPersonUploadedPackagesView(TestCaseWithFactory):
1347 layer = DatabaseFunctionalLayer1347 layer = DatabaseFunctionalLayer
13481348
1349 def setUp(self):1349 def setUp(self):
1350 super(TestPersonUploadedPackagesView, self).setUp()1350 super().setUp()
1351 self.user = self.factory.makePerson()1351 self.user = self.factory.makePerson()
1352 archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)1352 archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)
1353 spr = self.factory.makeSourcePackageRelease(1353 spr = self.factory.makeSourcePackageRelease(
@@ -1371,7 +1371,7 @@ class TestPersonPPAPackagesView(TestCaseWithFactory):
1371 layer = DatabaseFunctionalLayer1371 layer = DatabaseFunctionalLayer
13721372
1373 def setUp(self):1373 def setUp(self):
1374 super(TestPersonPPAPackagesView, self).setUp()1374 super().setUp()
1375 self.user = self.factory.makePerson()1375 self.user = self.factory.makePerson()
1376 self.view = create_initialized_view(self.user, '+ppa-packages')1376 self.view = create_initialized_view(self.user, '+ppa-packages')
13771377
@@ -1432,7 +1432,7 @@ class TestPersonSynchronisedPackagesView(TestCaseWithFactory):
1432 layer = DatabaseFunctionalLayer1432 layer = DatabaseFunctionalLayer
14331433
1434 def setUp(self):1434 def setUp(self):
1435 super(TestPersonSynchronisedPackagesView, self).setUp()1435 super().setUp()
1436 user = self.factory.makePerson()1436 user = self.factory.makePerson()
1437 archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)1437 archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)
1438 spr = self.factory.makeSourcePackageRelease(1438 spr = self.factory.makeSourcePackageRelease(
@@ -1463,7 +1463,7 @@ class TestPersonRelatedProjectsView(TestCaseWithFactory):
1463 layer = DatabaseFunctionalLayer1463 layer = DatabaseFunctionalLayer
14641464
1465 def setUp(self):1465 def setUp(self):
1466 super(TestPersonRelatedProjectsView, self).setUp()1466 super().setUp()
1467 self.user = self.factory.makePerson()1467 self.user = self.factory.makePerson()
14681468
1469 def test_view_helper_attributes(self):1469 def test_view_helper_attributes(self):
@@ -1498,7 +1498,7 @@ class TestPersonOCIRegistryCredentialsView(
1498 ]1498 ]
14991499
1500 def setUp(self):1500 def setUp(self):
1501 super(TestPersonOCIRegistryCredentialsView, self).setUp()1501 super().setUp()
1502 self.setConfig()1502 self.setConfig()
1503 if self.use_team:1503 if self.use_team:
1504 self.owner = self.factory.makeTeam(members=[self.user])1504 self.owner = self.factory.makeTeam(members=[self.user])
@@ -1721,7 +1721,7 @@ class TestPersonLiveFSView(BrowserTestCase):
1721 layer = DatabaseFunctionalLayer1721 layer = DatabaseFunctionalLayer
17221722
1723 def setUp(self):1723 def setUp(self):
1724 super(TestPersonLiveFSView, self).setUp()1724 super().setUp()
1725 self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))1725 self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
1726 self.person = self.factory.makePerson(1726 self.person = self.factory.makePerson(
1727 name="test-person", displayname="Test Person")1727 name="test-person", displayname="Test Person")
@@ -1869,7 +1869,7 @@ class TestPersonRelatedPackagesFailedBuild(TestCaseWithFactory):
1869 layer = LaunchpadFunctionalLayer1869 layer = LaunchpadFunctionalLayer
18701870
1871 def setUp(self):1871 def setUp(self):
1872 super(TestPersonRelatedPackagesFailedBuild, self).setUp()1872 super().setUp()
1873 self.user = self.factory.makePerson()1873 self.user = self.factory.makePerson()
18741874
1875 # First we need to publish some PPA packages with failed builds1875 # First we need to publish some PPA packages with failed builds
@@ -1923,7 +1923,7 @@ class TestPersonRelatedPackagesSynchronisedPackages(TestCaseWithFactory):
1923 layer = LaunchpadFunctionalLayer1923 layer = LaunchpadFunctionalLayer
19241924
1925 def setUp(self):1925 def setUp(self):
1926 super(TestPersonRelatedPackagesSynchronisedPackages, self).setUp()1926 super().setUp()
1927 self.user = self.factory.makePerson()1927 self.user = self.factory.makePerson()
1928 self.spph = self.factory.makeSourcePackagePublishingHistory()1928 self.spph = self.factory.makeSourcePackagePublishingHistory()
19291929
@@ -2023,7 +2023,7 @@ class TestTeamInvitationView(TestCaseWithFactory):
2023 layer = DatabaseFunctionalLayer2023 layer = DatabaseFunctionalLayer
20242024
2025 def setUp(self):2025 def setUp(self):
2026 super(TestTeamInvitationView, self).setUp()2026 super().setUp()
2027 self.a_team = self.factory.makeTeam(name="team-a",2027 self.a_team = self.factory.makeTeam(name="team-a",
2028 displayname="A-Team")2028 displayname="A-Team")
2029 self.b_team = self.factory.makeTeam(name="team-b",2029 self.b_team = self.factory.makeTeam(name="team-b",
@@ -2046,7 +2046,7 @@ class TestTeamInvitationView(TestCaseWithFactory):
2046 notifications = view.request.response.notifications2046 notifications = view.request.response.notifications
2047 self.assertEqual(1, len(notifications))2047 self.assertEqual(1, len(notifications))
2048 self.assertEqual(2048 self.assertEqual(
2049 u'B-Team (team-b) has been invited to join this team.',2049 'B-Team (team-b) has been invited to join this team.',
2050 notifications[0].message)2050 notifications[0].message)
20512051
2052 # B invites A.2052 # B invites A.
@@ -2058,7 +2058,7 @@ class TestTeamInvitationView(TestCaseWithFactory):
2058 notifications = view.request.response.notifications2058 notifications = view.request.response.notifications
2059 self.assertEqual(1, len(notifications))2059 self.assertEqual(1, len(notifications))
2060 self.assertEqual(2060 self.assertEqual(
2061 u'A-Team (team-a) has been invited to join this team.',2061 'A-Team (team-a) has been invited to join this team.',
2062 notifications[0].message)2062 notifications[0].message)
20632063
2064 # Team A accepts the invitation.2064 # Team A accepts the invitation.
@@ -2078,7 +2078,7 @@ class TestTeamInvitationView(TestCaseWithFactory):
2078 notifications = view.request.response.notifications2078 notifications = view.request.response.notifications
2079 self.assertEqual(1, len(notifications))2079 self.assertEqual(1, len(notifications))
2080 self.assertEqual(2080 self.assertEqual(
2081 u'This team is now a member of B-Team.',2081 'This team is now a member of B-Team.',
2082 notifications[0].message)2082 notifications[0].message)
20832083
2084 # Team B attempts to accept the invitation.2084 # Team B attempts to accept the invitation.
@@ -2093,7 +2093,7 @@ class TestTeamInvitationView(TestCaseWithFactory):
2093 notifications = view.request.response.notifications2093 notifications = view.request.response.notifications
2094 self.assertEqual(1, len(notifications))2094 self.assertEqual(1, len(notifications))
2095 expected = (2095 expected = (
2096 u'This team may not be added to A-Team because it is a member '2096 'This team may not be added to A-Team because it is a member '
2097 'of B-Team.')2097 'of B-Team.')
2098 self.assertEqual(2098 self.assertEqual(
2099 expected,2099 expected,
@@ -2105,8 +2105,7 @@ class TestSubscriptionsView(TestCaseWithFactory):
2105 layer = LaunchpadFunctionalLayer2105 layer = LaunchpadFunctionalLayer
21062106
2107 def setUp(self):2107 def setUp(self):
2108 super(TestSubscriptionsView, self).setUp(2108 super().setUp(user='test@canonical.com')
2109 user='test@canonical.com')
2110 self.user = getUtility(ILaunchBag).user2109 self.user = getUtility(ILaunchBag).user
2111 self.person = self.factory.makePerson()2110 self.person = self.factory.makePerson()
2112 self.other_person = self.factory.makePerson()2111 self.other_person = self.factory.makePerson()
@@ -2135,7 +2134,7 @@ class BugTaskViewsTestBase:
2135 layer = DatabaseFunctionalLayer2134 layer = DatabaseFunctionalLayer
21362135
2137 def setUp(self):2136 def setUp(self):
2138 super(BugTaskViewsTestBase, self).setUp()2137 super().setUp()
2139 self.person = self.factory.makePerson()2138 self.person = self.factory.makePerson()
2140 with person_logged_in(self.person):2139 with person_logged_in(self.person):
2141 self.subscribed_bug = self.factory.makeBug()2140 self.subscribed_bug = self.factory.makeBug()
@@ -2189,7 +2188,7 @@ class TestPersonRelatedBugTaskSearchListingView(
2189 view_name = '+bugs'2188 view_name = '+bugs'
21902189
2191 def setUp(self):2190 def setUp(self):
2192 super(TestPersonRelatedBugTaskSearchListingView, self).setUp()2191 super().setUp()
2193 self.expected_for_search_unbatched = [2192 self.expected_for_search_unbatched = [
2194 self.subscribed_bug.default_bugtask,2193 self.subscribed_bug.default_bugtask,
2195 self.assigned_bug.default_bugtask,2194 self.assigned_bug.default_bugtask,
@@ -2205,7 +2204,7 @@ class TestPersonAssignedBugTaskSearchListingView(
2205 view_name = '+assignedbugs'2204 view_name = '+assignedbugs'
22062205
2207 def setUp(self):2206 def setUp(self):
2208 super(TestPersonAssignedBugTaskSearchListingView, self).setUp()2207 super().setUp()
2209 self.expected_for_search_unbatched = [2208 self.expected_for_search_unbatched = [
2210 self.assigned_bug.default_bugtask,2209 self.assigned_bug.default_bugtask,
2211 ]2210 ]
@@ -2218,7 +2217,7 @@ class TestPersonCommentedBugTaskSearchListingView(
2218 view_name = '+commentedbugs'2217 view_name = '+commentedbugs'
22192218
2220 def setUp(self):2219 def setUp(self):
2221 super(TestPersonCommentedBugTaskSearchListingView, self).setUp()2220 super().setUp()
2222 self.expected_for_search_unbatched = [2221 self.expected_for_search_unbatched = [
2223 self.commented_bug.default_bugtask,2222 self.commented_bug.default_bugtask,
2224 ]2223 ]
@@ -2231,7 +2230,7 @@ class TestPersonReportedBugTaskSearchListingView(
2231 view_name = '+reportedbugs'2230 view_name = '+reportedbugs'
22322231
2233 def setUp(self):2232 def setUp(self):
2234 super(TestPersonReportedBugTaskSearchListingView, self).setUp()2233 super().setUp()
2235 self.expected_for_search_unbatched = [2234 self.expected_for_search_unbatched = [
2236 self.owned_bug.default_bugtask,2235 self.owned_bug.default_bugtask,
2237 ]2236 ]
@@ -2244,7 +2243,7 @@ class TestPersonSubscribedBugTaskSearchListingView(
2244 view_name = '+subscribedbugs'2243 view_name = '+subscribedbugs'
22452244
2246 def setUp(self):2245 def setUp(self):
2247 super(TestPersonSubscribedBugTaskSearchListingView, self).setUp()2246 super().setUp()
2248 self.expected_for_search_unbatched = [2247 self.expected_for_search_unbatched = [
2249 self.subscribed_bug.default_bugtask,2248 self.subscribed_bug.default_bugtask,
2250 self.owned_bug.default_bugtask,2249 self.owned_bug.default_bugtask,
@@ -2258,7 +2257,7 @@ class TestPersonAffectingBugTaskSearchListingView(
2258 view_name = '+affectingbugs'2257 view_name = '+affectingbugs'
22592258
2260 def setUp(self):2259 def setUp(self):
2261 super(TestPersonAffectingBugTaskSearchListingView, self).setUp()2260 super().setUp()
2262 # Bugs filed by this user are marked as affecting them by default, so2261 # Bugs filed by this user are marked as affecting them by default, so
2263 # the bug we filed is returned.2262 # the bug we filed is returned.
2264 self.expected_for_search_unbatched = [2263 self.expected_for_search_unbatched = [
diff --git a/lib/lp/registry/browser/tests/test_person_contact.py b/lib/lp/registry/browser/tests/test_person_contact.py
index 3696a64..4d26d16 100644
--- a/lib/lp/registry/browser/tests/test_person_contact.py
+++ b/lib/lp/registry/browser/tests/test_person_contact.py
@@ -424,7 +424,7 @@ class EmailToPersonViewTestCase(TestCaseWithFactory):
424 with person_logged_in(sender):424 with person_logged_in(sender):
425 view = create_initialized_view(user, '+contactuser', form=form)425 view = create_initialized_view(user, '+contactuser', form=form)
426 self.assertEqual(426 self.assertEqual(
427 [u'You must provide a subject and a message.'], view.errors)427 ['You must provide a subject and a message.'], view.errors)
428428
429 def test_submitted_after_quota(self):429 def test_submitted_after_quota(self):
430 # The view explains when a message was not sent because the quota430 # The view explains when a message was not sent because the quota
diff --git a/lib/lp/registry/browser/tests/test_person_webservice.py b/lib/lp/registry/browser/tests/test_person_webservice.py
index 2f5bc88..6d2ccdb 100644
--- a/lib/lp/registry/browser/tests/test_person_webservice.py
+++ b/lib/lp/registry/browser/tests/test_person_webservice.py
@@ -50,7 +50,7 @@ class TestPersonEmailSecurity(TestCaseWithFactory):
50 layer = DatabaseFunctionalLayer50 layer = DatabaseFunctionalLayer
5151
52 def setUp(self):52 def setUp(self):
53 super(TestPersonEmailSecurity, self).setUp()53 super().setUp()
54 self.target = self.factory.makePerson(name='target')54 self.target = self.factory.makePerson(name='target')
55 self.email_one = self.factory.makeEmail(55 self.email_one = self.factory.makeEmail(
56 'test1@example.com', self.target)56 'test1@example.com', self.target)
@@ -87,7 +87,7 @@ class TestPersonAccountStatus(TestCaseWithFactory):
87 person = self.factory.makePerson()87 person = self.factory.makePerson()
88 registrar = self.factory.makePerson(88 registrar = self.factory.makePerson(
89 member_of=[getUtility(IPersonSet).getByName('registry')])89 member_of=[getUtility(IPersonSet).getByName('registry')])
90 removeSecurityProxy(person.account).status_history = u'Test'90 removeSecurityProxy(person.account).status_history = 'Test'
91 person_url = api_url(person)91 person_url = api_url(person)
9292
93 # A normal user cannot read account_status_history. Not even93 # A normal user cannot read account_status_history. Not even
@@ -178,7 +178,7 @@ class PersonWebServiceTests(TestCaseWithFactory):
178 team.addMember(person, owner)178 team.addMember(person, owner)
179 getUtility(ITeamMembershipSet).getByPersonAndTeam(179 getUtility(ITeamMembershipSet).getByPersonAndTeam(
180 person, team).setStatus(180 person, team).setStatus(
181 TeamMembershipStatus.DEACTIVATED, owner, u"Go away.")181 TeamMembershipStatus.DEACTIVATED, owner, "Go away.")
182182
183 def get_members():183 def get_members():
184 ws.get('/~%s/deactivated_members' % name).jsonBody()184 ws.get('/~%s/deactivated_members' % name).jsonBody()
@@ -250,7 +250,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory):
250 layer = DatabaseFunctionalLayer250 layer = DatabaseFunctionalLayer
251251
252 def setUp(self):252 def setUp(self):
253 super(PersonSetWebServiceTests, self).setUp()253 super().setUp()
254 self.webservice = webservice_for_person(None)254 self.webservice = webservice_for_person(None)
255255
256 def assertReturnsPeople(self, expected_names, path):256 def assertReturnsPeople(self, expected_names, path):
@@ -309,7 +309,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory):
309 def test_find_by_date(self):309 def test_find_by_date(self):
310 # Creation date filtering is supported.310 # Creation date filtering is supported.
311 self.assertReturnsPeople(311 self.assertReturnsPeople(
312 [u'bac'],312 ['bac'],
313 '/people?ws.op=findPerson&text='313 '/people?ws.op=findPerson&text='
314 '&created_after=2008-06-27&created_before=2008-07-01')314 '&created_after=2008-06-27&created_before=2008-07-01')
315315
@@ -401,7 +401,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory):
401 account_status=AccountStatus.SUSPENDED)401 account_status=AccountStatus.SUSPENDED)
402 oid = OpenIdIdentifier()402 oid = OpenIdIdentifier()
403 oid.account = existing.account403 oid.account = existing.account
404 oid.identifier = u'somebody'404 oid.identifier = 'somebody'
405 Store.of(existing).add(oid)405 Store.of(existing).add(oid)
406 sca = getUtility(IPersonSet).getByName('software-center-agent')406 sca = getUtility(IPersonSet).getByName('software-center-agent')
407 response = self.getOrCreateSoftwareCenterCustomer(sca)407 response = self.getOrCreateSoftwareCenterCustomer(sca)
@@ -415,7 +415,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory):
415 account_status=AccountStatus.DECEASED)415 account_status=AccountStatus.DECEASED)
416 oid = OpenIdIdentifier()416 oid = OpenIdIdentifier()
417 oid.account = existing.account417 oid.account = existing.account
418 oid.identifier = u'somebody'418 oid.identifier = 'somebody'
419 Store.of(existing).add(oid)419 Store.of(existing).add(oid)
420 sca = getUtility(IPersonSet).getByName('software-center-agent')420 sca = getUtility(IPersonSet).getByName('software-center-agent')
421 response = self.getOrCreateSoftwareCenterCustomer(sca)421 response = self.getOrCreateSoftwareCenterCustomer(sca)
@@ -468,7 +468,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory):
468 with admin_logged_in():468 with admin_logged_in():
469 by_name = getUtility(IPersonSet).getByName('bar')469 by_name = getUtility(IPersonSet).getByName('bar')
470 by_openid = getUtility(IPersonSet).getByOpenIDIdentifier(470 by_openid = getUtility(IPersonSet).getByOpenIDIdentifier(
471 u'http://testopenid.test/+id/foo')471 'http://testopenid.test/+id/foo')
472 self.assertEqual(by_name, by_openid)472 self.assertEqual(by_name, by_openid)
473 self.assertEqual(473 self.assertEqual(
474 AccountStatus.PLACEHOLDER, by_name.account_status)474 AccountStatus.PLACEHOLDER, by_name.account_status)
@@ -485,7 +485,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory):
485 self.assertIs(None, getUtility(IPersonSet).getByName('bar'))485 self.assertIs(None, getUtility(IPersonSet).getByName('bar'))
486 self.assertRaises(486 self.assertRaises(
487 LookupError,487 LookupError,
488 getUtility(IAccountSet).getByOpenIDIdentifier, u'foo')488 getUtility(IAccountSet).getByOpenIDIdentifier, 'foo')
489489
490 def test_setUsernameFromSSO_is_restricted(self):490 def test_setUsernameFromSSO_is_restricted(self):
491 # The method may only be invoked by the ~ubuntu-sso celebrity491 # The method may only be invoked by the ~ubuntu-sso celebrity
diff --git a/lib/lp/registry/browser/tests/test_pillar_sharing.py b/lib/lp/registry/browser/tests/test_pillar_sharing.py
index dbfd6b2..8ef5a25 100644
--- a/lib/lp/registry/browser/tests/test_pillar_sharing.py
+++ b/lib/lp/registry/browser/tests/test_pillar_sharing.py
@@ -63,7 +63,7 @@ class SharingBaseTestCase(TestCaseWithFactory):
63 pillar_type = None63 pillar_type = None
6464
65 def setUp(self):65 def setUp(self):
66 super(SharingBaseTestCase, self).setUp()66 super().setUp()
67 self.driver = self.factory.makePerson()67 self.driver = self.factory.makePerson()
68 self.owner = self.factory.makePerson()68 self.owner = self.factory.makePerson()
69 if self.pillar_type == 'distribution':69 if self.pillar_type == 'distribution':
@@ -249,7 +249,7 @@ class TestProductSharingDetailsView(
249 pillar_type = 'product'249 pillar_type = 'product'
250250
251 def setUp(self):251 def setUp(self):
252 super(TestProductSharingDetailsView, self).setUp()252 super().setUp()
253 login_person(self.owner)253 login_person(self.owner)
254254
255255
@@ -259,7 +259,7 @@ class TestDistributionSharingDetailsView(
259 pillar_type = 'distribution'259 pillar_type = 'distribution'
260260
261 def setUp(self):261 def setUp(self):
262 super(TestDistributionSharingDetailsView, self).setUp()262 super().setUp()
263 login_person(self.owner)263 login_person(self.owner)
264264
265265
@@ -471,7 +471,7 @@ class TestProductSharingView(PillarSharingViewTestMixin,
471 pillar_type = 'product'471 pillar_type = 'product'
472472
473 def setUp(self):473 def setUp(self):
474 super(TestProductSharingView, self).setUp()474 super().setUp()
475 self.setupSharing(self.grantees)475 self.setupSharing(self.grantees)
476 login_person(self.driver)476 login_person(self.driver)
477 # Use a FakeLogger fixture to prevent Memcached warnings to be477 # Use a FakeLogger fixture to prevent Memcached warnings to be
@@ -517,7 +517,7 @@ class TestDistributionSharingView(PillarSharingViewTestMixin,
517 pillar_type = 'distribution'517 pillar_type = 'distribution'
518518
519 def setUp(self):519 def setUp(self):
520 super(TestDistributionSharingView, self).setUp()520 super().setUp()
521 self.setupSharing(self.grantees)521 self.setupSharing(self.grantees)
522 login_person(self.driver)522 login_person(self.driver)
523523
diff --git a/lib/lp/registry/browser/tests/test_poll.py b/lib/lp/registry/browser/tests/test_poll.py
index 05f0183..b689df6 100644
--- a/lib/lp/registry/browser/tests/test_poll.py
+++ b/lib/lp/registry/browser/tests/test_poll.py
@@ -29,7 +29,7 @@ class TestPollVoteView(TestCaseWithFactory):
29 layer = DatabaseFunctionalLayer29 layer = DatabaseFunctionalLayer
3030
31 def setUp(self):31 def setUp(self):
32 super(TestPollVoteView, self).setUp()32 super().setUp()
33 self.team = self.factory.makeTeam()33 self.team = self.factory.makeTeam()
3434
35 def test_simple_poll_template(self):35 def test_simple_poll_template(self):
@@ -55,7 +55,7 @@ class TestPollAddView(BrowserTestCase):
55 layer = DatabaseFunctionalLayer55 layer = DatabaseFunctionalLayer
5656
57 def setUp(self):57 def setUp(self):
58 super(TestPollAddView, self).setUp()58 super().setUp()
59 self.pushConfig(59 self.pushConfig(
60 "launchpad", min_legitimate_karma=5, min_legitimate_account_age=5)60 "launchpad", min_legitimate_karma=5, min_legitimate_account_age=5)
6161
diff --git a/lib/lp/registry/browser/tests/test_product.py b/lib/lp/registry/browser/tests/test_product.py
index 1f571fe..c79cbd1 100644
--- a/lib/lp/registry/browser/tests/test_product.py
+++ b/lib/lp/registry/browser/tests/test_product.py
@@ -206,7 +206,7 @@ class TestProductConfiguration(BrowserTestCase):
206 layer = DatabaseFunctionalLayer206 layer = DatabaseFunctionalLayer
207207
208 def setUp(self):208 def setUp(self):
209 super(TestProductConfiguration, self).setUp()209 super().setUp()
210 self.product = self.factory.makeProduct()210 self.product = self.factory.makeProduct()
211211
212 def test_registration_not_done(self):212 def test_registration_not_done(self):
@@ -295,7 +295,7 @@ class TestProductAddView(TestCaseWithFactory):
295 layer = DatabaseFunctionalLayer295 layer = DatabaseFunctionalLayer
296296
297 def setUp(self):297 def setUp(self):
298 super(TestProductAddView, self).setUp()298 super().setUp()
299 self.product_set = getUtility(IProductSet)299 self.product_set = getUtility(IProductSet)
300300
301 def test_view_data_model(self):301 def test_view_data_model(self):
@@ -424,7 +424,7 @@ class TestProductView(BrowserTestCase):
424 layer = DatabaseFunctionalLayer424 layer = DatabaseFunctionalLayer
425425
426 def setUp(self):426 def setUp(self):
427 super(TestProductView, self).setUp()427 super().setUp()
428 self.product = self.factory.makeProduct(name='fnord')428 self.product = self.factory.makeProduct(name='fnord')
429 self.tag_meta_noindex = Tag(429 self.tag_meta_noindex = Tag(
430 'meta_noindex', 'meta', attrs={430 'meta_noindex', 'meta', attrs={
@@ -741,7 +741,7 @@ class TestProductEditView(BrowserTestCase):
741 layer = DatabaseFunctionalLayer741 layer = DatabaseFunctionalLayer
742742
743 def setUp(self):743 def setUp(self):
744 super(TestProductEditView, self).setUp()744 super().setUp()
745745
746 def _make_product_edit_form(self, product, proprietary=False):746 def _make_product_edit_form(self, product, proprietary=False):
747 """Return form data for product edit.747 """Return form data for product edit.
@@ -927,7 +927,7 @@ class ProductSetReviewLicensesViewTestCase(TestCaseWithFactory):
927 layer = LaunchpadFunctionalLayer927 layer = LaunchpadFunctionalLayer
928928
929 def setUp(self):929 def setUp(self):
930 super(ProductSetReviewLicensesViewTestCase, self).setUp()930 super().setUp()
931 self.product_set = getUtility(IProductSet)931 self.product_set = getUtility(IProductSet)
932 self.user = login_celebrity('registry_experts')932 self.user = login_celebrity('registry_experts')
933933
diff --git a/lib/lp/registry/browser/tests/test_projectgroup.py b/lib/lp/registry/browser/tests/test_projectgroup.py
index 75c9d9f..a76ae7d 100644
--- a/lib/lp/registry/browser/tests/test_projectgroup.py
+++ b/lib/lp/registry/browser/tests/test_projectgroup.py
@@ -39,7 +39,7 @@ class TestProjectGroupView(BrowserTestCase):
39 layer = DatabaseFunctionalLayer39 layer = DatabaseFunctionalLayer
4040
41 def setUp(self):41 def setUp(self):
42 super(TestProjectGroupView, self).setUp()42 super().setUp()
43 self.project_group = self.factory.makeProject(name='group')43 self.project_group = self.factory.makeProject(name='group')
4444
45 def test_view_data_model(self):45 def test_view_data_model(self):
@@ -136,7 +136,7 @@ class TestProjectGroupEditView(TestCaseWithFactory):
136 layer = DatabaseFunctionalLayer136 layer = DatabaseFunctionalLayer
137137
138 def setUp(self):138 def setUp(self):
139 super(TestProjectGroupEditView, self).setUp()139 super().setUp()
140 self.project_group = self.factory.makeProject(name='group')140 self.project_group = self.factory.makeProject(name='group')
141 # Use a FakeLogger fixture to prevent Memcached warnings to be141 # Use a FakeLogger fixture to prevent Memcached warnings to be
142 # printed to stdout while browsing pages.142 # printed to stdout while browsing pages.
diff --git a/lib/lp/registry/browser/tests/test_reassign_team_view.py b/lib/lp/registry/browser/tests/test_reassign_team_view.py
index c5cba77..cad98ce 100644
--- a/lib/lp/registry/browser/tests/test_reassign_team_view.py
+++ b/lib/lp/registry/browser/tests/test_reassign_team_view.py
@@ -153,7 +153,7 @@ class TestTeamReassignmentViewErrors(TestCaseWithFactory):
153 a_team, '+reassign', form=form, principal=owner)153 a_team, '+reassign', form=form, principal=owner)
154 self.assertEqual(154 self.assertEqual(
155 [html_escape(155 [html_escape(
156 u"There's already a person/team with the name 'a-team' in "156 "There's already a person/team with the name 'a-team' in "
157 "Launchpad. Please choose a different name or select the "157 "Launchpad. Please choose a different name or select the "
158 "option to make that person/team the new owner, if that's "158 "option to make that person/team the new owner, if that's "
159 "what you want.")],159 "what you want.")],
diff --git a/lib/lp/registry/browser/tests/test_sourcepackage_views.py b/lib/lp/registry/browser/tests/test_sourcepackage_views.py
index eb5ccd3..dcb66d0 100644
--- a/lib/lp/registry/browser/tests/test_sourcepackage_views.py
+++ b/lib/lp/registry/browser/tests/test_sourcepackage_views.py
@@ -221,7 +221,7 @@ class TestSourcePackageUpstreamConnectionsView(TestCaseWithFactory):
221 layer = DatabaseFunctionalLayer221 layer = DatabaseFunctionalLayer
222222
223 def setUp(self):223 def setUp(self):
224 super(TestSourcePackageUpstreamConnectionsView, self).setUp()224 super().setUp()
225 productseries = self.factory.makeProductSeries(name='1.0')225 productseries = self.factory.makeProductSeries(name='1.0')
226 self.milestone = self.factory.makeMilestone(226 self.milestone = self.factory.makeMilestone(
227 product=productseries.product, productseries=productseries)227 product=productseries.product, productseries=productseries)
diff --git a/lib/lp/registry/browser/tests/test_subscription_links.py b/lib/lp/registry/browser/tests/test_subscription_links.py
index 0c820b8..886e078 100644
--- a/lib/lp/registry/browser/tests/test_subscription_links.py
+++ b/lib/lp/registry/browser/tests/test_subscription_links.py
@@ -85,7 +85,7 @@ class _TestStructSubs(TestCaseWithFactory, _TestResultsMixin):
85 layer = DatabaseFunctionalLayer85 layer = DatabaseFunctionalLayer
8686
87 def setUp(self):87 def setUp(self):
88 super(_TestStructSubs, self).setUp()88 super().setUp()
89 self.regular_user = self.factory.makePerson()89 self.regular_user = self.factory.makePerson()
90 # Use a FakeLogger fixture to prevent Memcached warnings to be90 # Use a FakeLogger fixture to prevent Memcached warnings to be
91 # printed to stdout while browsing pages.91 # printed to stdout while browsing pages.
@@ -123,7 +123,7 @@ class ProductView(_TestStructSubs):
123 view = '+index'123 view = '+index'
124124
125 def setUp(self):125 def setUp(self):
126 super(ProductView, self).setUp()126 super().setUp()
127 self.target = self.factory.makeProduct(official_malone=True)127 self.target = self.factory.makeProduct(official_malone=True)
128128
129129
@@ -141,7 +141,7 @@ class ProjectGroupView(_TestStructSubs):
141 view = '+index'141 view = '+index'
142142
143 def setUp(self):143 def setUp(self):
144 super(ProjectGroupView, self).setUp()144 super().setUp()
145 self.target = self.factory.makeProject()145 self.target = self.factory.makeProject()
146 self.factory.makeProduct(146 self.factory.makeProduct(
147 projectgroup=self.target, official_malone=True)147 projectgroup=self.target, official_malone=True)
@@ -183,7 +183,7 @@ class ProductSeriesView(_TestStructSubs):
183 view = '+index'183 view = '+index'
184184
185 def setUp(self):185 def setUp(self):
186 super(ProductSeriesView, self).setUp()186 super().setUp()
187 product = self.factory.makeProduct(official_malone=True)187 product = self.factory.makeProduct(official_malone=True)
188 self.target = self.factory.makeProductSeries(product=product)188 self.target = self.factory.makeProductSeries(product=product)
189189
@@ -195,7 +195,7 @@ class ProductSeriesBugs(ProductSeriesView):
195 view = '+bugs'195 view = '+bugs'
196196
197 def setUp(self):197 def setUp(self):
198 super(ProductSeriesBugs, self).setUp()198 super().setUp()
199 with person_logged_in(self.target.product.owner):199 with person_logged_in(self.target.product.owner):
200 self.target.product.official_malone = True200 self.target.product.official_malone = True
201201
@@ -207,7 +207,7 @@ class DistributionSourcePackageView(_TestStructSubs):
207 view = '+index'207 view = '+index'
208208
209 def setUp(self):209 def setUp(self):
210 super(DistributionSourcePackageView, self).setUp()210 super().setUp()
211 distro = self.factory.makeDistribution()211 distro = self.factory.makeDistribution()
212 with person_logged_in(distro.owner):212 with person_logged_in(distro.owner):
213 distro.official_malone = True213 distro.official_malone = True
@@ -242,7 +242,7 @@ class DistroView(BrowserTestCase, _TestResultsMixin):
242 view = '+index'242 view = '+index'
243243
244 def setUp(self):244 def setUp(self):
245 super(DistroView, self).setUp()245 super().setUp()
246 self.target = self.factory.makeDistribution()246 self.target = self.factory.makeDistribution()
247 with person_logged_in(self.target.owner):247 with person_logged_in(self.target.owner):
248 self.target.official_malone = True248 self.target.official_malone = True
@@ -341,7 +341,7 @@ class DistroMilestoneView(DistroView):
341 """Test structural subscriptions on the distro milestones."""341 """Test structural subscriptions on the distro milestones."""
342342
343 def setUp(self):343 def setUp(self):
344 super(DistroMilestoneView, self).setUp()344 super().setUp()
345 self.distro = self.target345 self.distro = self.target
346 self.target = self.factory.makeMilestone(distribution=self.distro)346 self.target = self.factory.makeMilestone(distribution=self.distro)
347347
@@ -380,7 +380,7 @@ class ProductMilestoneView(DistroView):
380 """Test structural subscriptions on the product milestones."""380 """Test structural subscriptions on the product milestones."""
381381
382 def setUp(self):382 def setUp(self):
383 super(ProductMilestoneView, self).setUp()383 super().setUp()
384 self.product = self.factory.makeProduct()384 self.product = self.factory.makeProduct()
385 with person_logged_in(self.product.owner):385 with person_logged_in(self.product.owner):
386 self.product.official_malone = True386 self.product.official_malone = True
@@ -411,7 +411,7 @@ class ProductSeriesMilestoneView(ProductMilestoneView):
411 """Test structural subscriptions on the product series milestones."""411 """Test structural subscriptions on the product series milestones."""
412412
413 def setUp(self):413 def setUp(self):
414 super(ProductSeriesMilestoneView, self).setUp()414 super().setUp()
415 self.productseries = self.factory.makeProductSeries()415 self.productseries = self.factory.makeProductSeries()
416 with person_logged_in(self.productseries.product.owner):416 with person_logged_in(self.productseries.product.owner):
417 self.productseries.product.official_malone = True417 self.productseries.product.official_malone = True
@@ -426,7 +426,7 @@ class _DoesNotUseLP(ProductView):
426 """Test structural subscriptions on the product view."""426 """Test structural subscriptions on the product view."""
427427
428 def setUp(self):428 def setUp(self):
429 super(_DoesNotUseLP, self).setUp()429 super().setUp()
430 self.target = self.factory.makeProduct(official_malone=False)430 self.target = self.factory.makeProduct(official_malone=False)
431431
432 def test_subscribe_link_owner(self):432 def test_subscribe_link_owner(self):
@@ -472,7 +472,7 @@ class ProjectGroupDoesNotUseLPView(_DoesNotUseLP):
472 view = '+index'472 view = '+index'
473473
474 def setUp(self):474 def setUp(self):
475 super(ProjectGroupDoesNotUseLPView, self).setUp()475 super().setUp()
476 self.target = self.factory.makeProject()476 self.target = self.factory.makeProject()
477 self.factory.makeProduct(477 self.factory.makeProduct(
478 projectgroup=self.target, official_malone=False)478 projectgroup=self.target, official_malone=False)
@@ -485,7 +485,7 @@ class ProjectGroupDoesNotUseLPBugs(ProductDoesNotUseLPBugs):
485 view = '+bugs'485 view = '+bugs'
486486
487 def setUp(self):487 def setUp(self):
488 super(ProjectGroupDoesNotUseLPBugs, self).setUp()488 super().setUp()
489 self.target = self.factory.makeProject()489 self.target = self.factory.makeProject()
490 self.factory.makeProduct(490 self.factory.makeProduct(
491 projectgroup=self.target, official_malone=False)491 projectgroup=self.target, official_malone=False)
@@ -496,7 +496,7 @@ class ProjectGroupDoesNotUseLPBugs(ProductDoesNotUseLPBugs):
496class ProductSeriesDoesNotUseLPView(_DoesNotUseLP):496class ProductSeriesDoesNotUseLPView(_DoesNotUseLP):
497497
498 def setUp(self):498 def setUp(self):
499 super(ProductSeriesDoesNotUseLPView, self).setUp()499 super().setUp()
500 product = self.factory.makeProduct(official_malone=False)500 product = self.factory.makeProduct(official_malone=False)
501 self.target = self.factory.makeProductSeries(product=product)501 self.target = self.factory.makeProductSeries(product=product)
502502
@@ -504,7 +504,7 @@ class ProductSeriesDoesNotUseLPView(_DoesNotUseLP):
504class ProductSeriesDoesNotUseLPBugs(_DoesNotUseLP):504class ProductSeriesDoesNotUseLPBugs(_DoesNotUseLP):
505505
506 def setUp(self):506 def setUp(self):
507 super(ProductSeriesDoesNotUseLPBugs, self).setUp()507 super().setUp()
508 product = self.factory.makeProduct(official_malone=False)508 product = self.factory.makeProduct(official_malone=False)
509 self.target = self.factory.makeProductSeries(product=product)509 self.target = self.factory.makeProductSeries(product=product)
510510
@@ -513,7 +513,7 @@ class DistributionSourcePackageDoesNotUseLPView(_DoesNotUseLP):
513 """Test structural subscriptions on the distro src pkg view."""513 """Test structural subscriptions on the distro src pkg view."""
514514
515 def setUp(self):515 def setUp(self):
516 super(DistributionSourcePackageDoesNotUseLPView, self).setUp()516 super().setUp()
517 distro = self.factory.makeDistribution()517 distro = self.factory.makeDistribution()
518 self.target = self.factory.makeDistributionSourcePackage(518 self.target = self.factory.makeDistributionSourcePackage(
519 distribution=distro)519 distribution=distro)
@@ -535,7 +535,7 @@ class DistributionSourcePackageDoesNotUseLPBugs(ProductDoesNotUseLPBugs):
535class DistroDoesNotUseLPView(DistroView):535class DistroDoesNotUseLPView(DistroView):
536536
537 def setUp(self):537 def setUp(self):
538 super(DistroDoesNotUseLPView, self).setUp()538 super().setUp()
539 self.target = self.factory.makeDistribution()539 self.target = self.factory.makeDistribution()
540 self.regular_user = self.factory.makePerson()540 self.regular_user = self.factory.makePerson()
541541
@@ -577,7 +577,7 @@ class DistroDoesNotUseLPBugs(DistroDoesNotUseLPView):
577class DistroMilestoneDoesNotUseLPView(DistroMilestoneView):577class DistroMilestoneDoesNotUseLPView(DistroMilestoneView):
578578
579 def setUp(self):579 def setUp(self):
580 super(DistroMilestoneDoesNotUseLPView, self).setUp()580 super().setUp()
581 with person_logged_in(self.distro.owner):581 with person_logged_in(self.distro.owner):
582 self.distro.official_malone = False582 self.distro.official_malone = False
583583
@@ -620,7 +620,7 @@ class DistroMilestoneDoesNotUseLPView(DistroMilestoneView):
620class ProductMilestoneDoesNotUseLPView(ProductMilestoneView):620class ProductMilestoneDoesNotUseLPView(ProductMilestoneView):
621621
622 def setUp(self):622 def setUp(self):
623 super(ProductMilestoneDoesNotUseLPView, self).setUp()623 super().setUp()
624 self.product = self.factory.makeProduct()624 self.product = self.factory.makeProduct()
625 with person_logged_in(self.product.owner):625 with person_logged_in(self.product.owner):
626 self.product.official_malone = False626 self.product.official_malone = False
@@ -648,8 +648,7 @@ class CustomTestLoader(unittest.TestLoader):
648 if testCaseClass is _TestStructSubs:648 if testCaseClass is _TestStructSubs:
649 return []649 return []
650 else:650 else:
651 return super(CustomTestLoader, self).getTestCaseNames(651 return super().getTestCaseNames(testCaseClass)
652 testCaseClass)
653652
654653
655def test_suite():654def test_suite():
diff --git a/lib/lp/registry/browser/tests/test_team.py b/lib/lp/registry/browser/tests/test_team.py
index 5a3f781..fb02cb2 100644
--- a/lib/lp/registry/browser/tests/test_team.py
+++ b/lib/lp/registry/browser/tests/test_team.py
@@ -70,7 +70,7 @@ class TestProposedTeamMembersEditView(TestCaseWithFactory):
70 layer = DatabaseFunctionalLayer70 layer = DatabaseFunctionalLayer
7171
72 def setUp(self):72 def setUp(self):
73 super(TestProposedTeamMembersEditView, self).setUp()73 super().setUp()
74 self.owner = self.factory.makePerson(name="team-owner")74 self.owner = self.factory.makePerson(name="team-owner")
75 self.a_team = self.makeTeam("team-a", "A-Team")75 self.a_team = self.makeTeam("team-a", "A-Team")
76 self.b_team = self.makeTeam("team-b", "B-Team")76 self.b_team = self.makeTeam("team-b", "B-Team")
@@ -97,7 +97,7 @@ class TestProposedTeamMembersEditView(TestCaseWithFactory):
97 self.assertEqual([], view.errors)97 self.assertEqual([], view.errors)
98 notifications = view.request.response.notifications98 notifications = view.request.response.notifications
99 self.assertEqual(1, len(notifications))99 self.assertEqual(1, len(notifications))
100 expected = u"%s has been proposed to this team." % (100 expected = "%s has been proposed to this team." % (
101 joiner.displayname)101 joiner.displayname)
102 self.assertEqual(102 self.assertEqual(
103 expected,103 expected,
@@ -112,13 +112,13 @@ class TestProposedTeamMembersEditView(TestCaseWithFactory):
112 failed_names = ', '.join([team.displayname for team in failed])112 failed_names = ', '.join([team.displayname for team in failed])
113 if len(failed) == 1:113 if len(failed) == 1:
114 failed_message = html_escape(114 failed_message = html_escape(
115 u'%s is a member of the following team, '115 '%s is a member of the following team, '
116 'so it could not be accepted: %s. '116 'so it could not be accepted: %s. '
117 'You need to "Decline" that team.' %117 'You need to "Decline" that team.' %
118 (joinee.displayname, failed_names))118 (joinee.displayname, failed_names))
119 else:119 else:
120 failed_message = html_escape(120 failed_message = html_escape(
121 u'%s is a member of the following teams, '121 '%s is a member of the following teams, '
122 'so they could not be accepted: %s. '122 'so they could not be accepted: %s. '
123 'You need to "Decline" those teams.' %123 'You need to "Decline" those teams.' %
124 (joinee.displayname, failed_names))124 (joinee.displayname, failed_names))
@@ -605,7 +605,7 @@ class TestTeamMenu(TestCaseWithFactory):
605 layer = DatabaseFunctionalLayer605 layer = DatabaseFunctionalLayer
606606
607 def setUp(self):607 def setUp(self):
608 super(TestTeamMenu, self).setUp()608 super().setUp()
609 self.team = self.factory.makeTeam()609 self.team = self.factory.makeTeam()
610610
611 def test_TeamIndexMenu(self):611 def test_TeamIndexMenu(self):
@@ -754,7 +754,7 @@ class TestTeamMemberAddView(TestCaseWithFactory):
754 layer = DatabaseFunctionalLayer754 layer = DatabaseFunctionalLayer
755755
756 def setUp(self):756 def setUp(self):
757 super(TestTeamMemberAddView, self).setUp()757 super().setUp()
758 self.team = self.factory.makeTeam(name='test-team')758 self.team = self.factory.makeTeam(name='test-team')
759 login_person(self.team.teamowner)759 login_person(self.team.teamowner)
760760
@@ -844,7 +844,7 @@ class TeamMembershipViewTestCase(TestCaseWithFactory):
844 team = self.factory.makeTeam(name='pting')844 team = self.factory.makeTeam(name='pting')
845 view = create_initialized_view(team, name='+members')845 view = create_initialized_view(team, name='+members')
846 self.assertEqual('Members', view.page_title)846 self.assertEqual('Members', view.page_title)
847 self.assertEqual(u'Members of \u201cPting\u201d', view.label)847 self.assertEqual('Members of \u201cPting\u201d', view.label)
848848
849849
850class TestTeamIndexView(TestCaseWithFactory):850class TestTeamIndexView(TestCaseWithFactory):
@@ -852,7 +852,7 @@ class TestTeamIndexView(TestCaseWithFactory):
852 layer = DatabaseFunctionalLayer852 layer = DatabaseFunctionalLayer
853853
854 def setUp(self):854 def setUp(self):
855 super(TestTeamIndexView, self).setUp()855 super().setUp()
856 self.team = self.factory.makeTeam(name='test-team')856 self.team = self.factory.makeTeam(name='test-team')
857 login_person(self.team.teamowner)857 login_person(self.team.teamowner)
858858
diff --git a/lib/lp/registry/browser/tests/test_teammembership.py b/lib/lp/registry/browser/tests/test_teammembership.py
index 21c953f..a87d121 100644
--- a/lib/lp/registry/browser/tests/test_teammembership.py
+++ b/lib/lp/registry/browser/tests/test_teammembership.py
@@ -23,7 +23,7 @@ class TestTeamMenu(TestCaseWithFactory):
23 layer = DatabaseFunctionalLayer23 layer = DatabaseFunctionalLayer
2424
25 def setUp(self):25 def setUp(self):
26 super(TestTeamMenu, self).setUp()26 super().setUp()
27 login_celebrity('admin')27 login_celebrity('admin')
28 self.membership_set = getUtility(ITeamMembershipSet)28 self.membership_set = getUtility(ITeamMembershipSet)
29 self.team = self.factory.makeTeam()29 self.team = self.factory.makeTeam()
diff --git a/lib/lp/registry/browser/widgets/ocicredentialswidget.py b/lib/lp/registry/browser/widgets/ocicredentialswidget.py
index b47f436..924903d 100644
--- a/lib/lp/registry/browser/widgets/ocicredentialswidget.py
+++ b/lib/lp/registry/browser/widgets/ocicredentialswidget.py
@@ -113,7 +113,7 @@ class OCICredentialsWidget(BrowserWidget, InputWidget):
113 self.getInputValue()113 self.getInputValue()
114 except InputErrors as error:114 except InputErrors as error:
115 self._error = error115 self._error = error
116 return super(OCICredentialsWidget, self).error()116 return super().error()
117117
118 def setRenderedValue(self, value):118 def setRenderedValue(self, value):
119 """See `IInputWidget`."""119 """See `IInputWidget`."""
diff --git a/lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py b/lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py
index 5494439..430e6c3 100644
--- a/lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py
+++ b/lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py
@@ -32,11 +32,11 @@ class TestOCICredentialsWidget(OCIConfigHelperMixin, TestCaseWithFactory):
32 layer = DatabaseFunctionalLayer32 layer = DatabaseFunctionalLayer
3333
34 def setUp(self):34 def setUp(self):
35 super(TestOCICredentialsWidget, self).setUp()35 super().setUp()
36 self.setConfig()36 self.setConfig()
37 field = Reference(37 field = Reference(
38 __name__="oci_registry_credentials",38 __name__="oci_registry_credentials",
39 schema=Interface, title=u"OCI Registry Credentials")39 schema=Interface, title="OCI Registry Credentials")
40 self.context = self.factory.makeDistribution()40 self.context = self.factory.makeDistribution()
41 field = field.bind(self.context)41 field = field.bind(self.context)
42 request = LaunchpadTestRequest()42 request = LaunchpadTestRequest()
@@ -163,7 +163,7 @@ class TestOCICredentialsWidget(OCIConfigHelperMixin, TestCaseWithFactory):
163 def test_getInputValue_valid(self):163 def test_getInputValue_valid(self):
164 field = Reference(164 field = Reference(
165 __name__="oci_registry_credentials",165 __name__="oci_registry_credentials",
166 schema=Interface, title=u"OCI Registry Credentials")166 schema=Interface, title="OCI Registry Credentials")
167 self.context = self.factory.makeDistribution(167 self.context = self.factory.makeDistribution(
168 oci_project_admin=self.owner)168 oci_project_admin=self.owner)
169 field = field.bind(self.context)169 field = field.bind(self.context)

Subscribers

People subscribed via source and target branches

to status/vote changes: