Merge ~cjwatson/launchpad:pyupgrade-py3-registry-1 into launchpad:master
- Git
- lp:~cjwatson/launchpad
- pyupgrade-py3-registry-1
- Merge into 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) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+413506@code.launchpad.net |
Commit message
lp.registry.
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs | |||
2 | index a251b8f..c594c33 100644 | |||
3 | --- a/.git-blame-ignore-revs | |||
4 | +++ b/.git-blame-ignore-revs | |||
5 | @@ -28,3 +28,5 @@ cee9b128d3e49ca814464eeeeec50e6bcabcc4ba | |||
6 | 28 | f36fe66e5e5a5e82ba8c3269e32d76bd573d1175 | 28 | f36fe66e5e5a5e82ba8c3269e32d76bd573d1175 |
7 | 29 | # apply pyupgrade --py3-plus to lp.{coop,oci} | 29 | # apply pyupgrade --py3-plus to lp.{coop,oci} |
8 | 30 | fbed83f22424df8fa5647349493f78937a520db5 | 30 | fbed83f22424df8fa5647349493f78937a520db5 |
9 | 31 | # apply pyupgrade --py3-plus to lp.registry.browser | ||
10 | 32 | 9c1665b1dfed3f6abf69afa192700172ea3089a1 | ||
11 | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml | |||
12 | index 22c2329..784ae6a 100644 | |||
13 | --- a/.pre-commit-config.yaml | |||
14 | +++ b/.pre-commit-config.yaml | |||
15 | @@ -52,6 +52,7 @@ repos: | |||
16 | 52 | |codehosting | 52 | |codehosting |
17 | 53 | |coop | 53 | |coop |
18 | 54 | |oci | 54 | |oci |
19 | 55 | |registry/browser | ||
20 | 55 | )/ | 56 | )/ |
21 | 56 | - repo: https://github.com/PyCQA/isort | 57 | - repo: https://github.com/PyCQA/isort |
22 | 57 | rev: 5.9.2 | 58 | rev: 5.9.2 |
23 | diff --git a/lib/lp/registry/browser/codeofconduct.py b/lib/lp/registry/browser/codeofconduct.py | |||
24 | index 65fc254..cda21f9 100644 | |||
25 | --- a/lib/lp/registry/browser/codeofconduct.py | |||
26 | +++ b/lib/lp/registry/browser/codeofconduct.py | |||
27 | @@ -175,7 +175,7 @@ class AffirmCodeOfConductView(LaunchpadFormView): | |||
28 | 175 | 175 | ||
29 | 176 | affirmed = copy_field( | 176 | affirmed = copy_field( |
30 | 177 | ISignedCodeOfConduct["affirmed"], | 177 | ISignedCodeOfConduct["affirmed"], |
32 | 178 | title=_("I agree to this Code of Conduct"), description=u"") | 178 | title=_("I agree to this Code of Conduct"), description="") |
33 | 179 | 179 | ||
34 | 180 | field_names = ['affirmed'] | 180 | field_names = ['affirmed'] |
35 | 181 | 181 | ||
36 | diff --git a/lib/lp/registry/browser/distribution.py b/lib/lp/registry/browser/distribution.py | |||
37 | index 741fab0..025e405 100644 | |||
38 | --- a/lib/lp/registry/browser/distribution.py | |||
39 | +++ b/lib/lp/registry/browser/distribution.py | |||
40 | @@ -372,7 +372,7 @@ class DistributionNavigationMenu(NavigationMenu, DistributionLinksMixin): | |||
41 | 372 | 372 | ||
42 | 373 | def search_oci_project(self): | 373 | def search_oci_project(self): |
43 | 374 | oci_projects = getUtility(IOCIProjectSet).findByPillarAndName( | 374 | oci_projects = getUtility(IOCIProjectSet).findByPillarAndName( |
45 | 375 | self.context, u'') | 375 | self.context, '') |
46 | 376 | text = 'Search for OCI project' | 376 | text = 'Search for OCI project' |
47 | 377 | link = Link('+search-oci-project', text, icon='info') | 377 | link = Link('+search-oci-project', text, icon='info') |
48 | 378 | link.enabled = not oci_projects.is_empty() | 378 | link.enabled = not oci_projects.is_empty() |
49 | @@ -574,7 +574,7 @@ class DistributionPackageSearchView(PackageSearchViewBase): | |||
50 | 574 | 574 | ||
51 | 575 | def initialize(self): | 575 | def initialize(self): |
52 | 576 | """Save the search type if provided.""" | 576 | """Save the search type if provided.""" |
54 | 577 | super(DistributionPackageSearchView, self).initialize() | 577 | super().initialize() |
55 | 578 | 578 | ||
56 | 579 | # If the distribution contains binary packages, then we'll | 579 | # If the distribution contains binary packages, then we'll |
57 | 580 | # default to searches on binary names, but allow the user to | 580 | # default to searches on binary names, but allow the user to |
58 | @@ -704,7 +704,7 @@ class DistributionView(PillarViewMixin, HasAnnouncementsView, FeedsMixin): | |||
59 | 704 | """Default Distribution view class.""" | 704 | """Default Distribution view class.""" |
60 | 705 | 705 | ||
61 | 706 | def initialize(self): | 706 | def initialize(self): |
63 | 707 | super(DistributionView, self).initialize() | 707 | super().initialize() |
64 | 708 | expose_structural_subscription_data_to_js( | 708 | expose_structural_subscription_data_to_js( |
65 | 709 | self.context, self.request, self.user) | 709 | self.context, self.request, self.user) |
66 | 710 | 710 | ||
67 | @@ -902,9 +902,9 @@ class RequireVirtualizedBuildersMixin: | |||
68 | 902 | return form.Fields( | 902 | return form.Fields( |
69 | 903 | Bool( | 903 | Bool( |
70 | 904 | __name__='require_virtualized', | 904 | __name__='require_virtualized', |
72 | 905 | title=u"Require virtualized builders", | 905 | title="Require virtualized builders", |
73 | 906 | description=( | 906 | description=( |
75 | 907 | u"Only build the distribution's packages on virtual " | 907 | "Only build the distribution's packages on virtual " |
76 | 908 | "builders."), | 908 | "builders."), |
77 | 909 | required=True)) | 909 | required=True)) |
78 | 910 | 910 | ||
79 | @@ -956,8 +956,8 @@ class DistributionAddView(LaunchpadFormView, RequireVirtualizedBuildersMixin, | |||
80 | 956 | self.form_fields += self.createRequireVirtualized() | 956 | self.form_fields += self.createRequireVirtualized() |
81 | 957 | self.form_fields += self.createEnabledProcessors( | 957 | self.form_fields += self.createEnabledProcessors( |
82 | 958 | getUtility(IProcessorSet).getAll(), | 958 | getUtility(IProcessorSet).getAll(), |
85 | 959 | u"The architectures on which the distribution's main archive can " | 959 | "The architectures on which the distribution's main archive can " |
86 | 960 | u"build.") | 960 | "build.") |
87 | 961 | 961 | ||
88 | 962 | @action("Save", name='save') | 962 | @action("Save", name='save') |
89 | 963 | def save_action(self, action, data): | 963 | def save_action(self, action, data): |
90 | @@ -1028,8 +1028,8 @@ class DistributionEditView(RegistryEditFormView, | |||
91 | 1028 | self.form_fields += self.createRequireVirtualized() | 1028 | self.form_fields += self.createRequireVirtualized() |
92 | 1029 | self.form_fields += self.createEnabledProcessors( | 1029 | self.form_fields += self.createEnabledProcessors( |
93 | 1030 | getUtility(IProcessorSet).getAll(), | 1030 | getUtility(IProcessorSet).getAll(), |
96 | 1031 | u"The architectures on which the distribution's main archive can " | 1031 | "The architectures on which the distribution's main archive can " |
97 | 1032 | u"build.") | 1032 | "build.") |
98 | 1033 | 1033 | ||
99 | 1034 | @property | 1034 | @property |
100 | 1035 | def initial_values(self): | 1035 | def initial_values(self): |
101 | @@ -1195,7 +1195,7 @@ class DistributionCountryArchiveMirrorsView(LaunchpadView): | |||
102 | 1195 | request = self.request | 1195 | request = self.request |
103 | 1196 | if not self.context.supports_mirrors: | 1196 | if not self.context.supports_mirrors: |
104 | 1197 | request.response.setStatus(404) | 1197 | request.response.setStatus(404) |
106 | 1198 | return u'' | 1198 | return '' |
107 | 1199 | ip_address = ipaddress_from_request(request) | 1199 | ip_address = ipaddress_from_request(request) |
108 | 1200 | country = request_country(request) | 1200 | country = request_country(request) |
109 | 1201 | mirrors = getUtility(IDistributionMirrorSet).getBestMirrorsForCountry( | 1201 | mirrors = getUtility(IDistributionMirrorSet).getBestMirrorsForCountry( |
110 | diff --git a/lib/lp/registry/browser/distributionsourcepackage.py b/lib/lp/registry/browser/distributionsourcepackage.py | |||
111 | index 48def0c..1d09774 100644 | |||
112 | --- a/lib/lp/registry/browser/distributionsourcepackage.py | |||
113 | +++ b/lib/lp/registry/browser/distributionsourcepackage.py | |||
114 | @@ -22,7 +22,6 @@ import operator | |||
115 | 22 | 22 | ||
116 | 23 | import apt_pkg | 23 | import apt_pkg |
117 | 24 | from lazr.delegates import delegate_to | 24 | from lazr.delegates import delegate_to |
118 | 25 | import six | ||
119 | 26 | from zope.component import getUtility | 25 | from zope.component import getUtility |
120 | 27 | from zope.interface import ( | 26 | from zope.interface import ( |
121 | 28 | implementer, | 27 | implementer, |
122 | @@ -119,7 +118,7 @@ class DistributionSourcePackageURL: | |||
123 | 119 | not self.context.distribution.redirect_default_traversal): | 118 | not self.context.distribution.redirect_default_traversal): |
124 | 120 | return self.context.name | 119 | return self.context.name |
125 | 121 | else: | 120 | else: |
127 | 122 | return u"+source/%s" % self.context.name | 121 | return "+source/%s" % self.context.name |
128 | 123 | 122 | ||
129 | 124 | 123 | ||
130 | 125 | class DistributionSourcePackageFormatterAPI(CustomizableFormatter): | 124 | class DistributionSourcePackageFormatterAPI(CustomizableFormatter): |
131 | @@ -298,7 +297,7 @@ class DistributionSourcePackageBaseView(LaunchpadView): | |||
132 | 298 | 297 | ||
133 | 299 | def not_empty(text): | 298 | def not_empty(text): |
134 | 300 | return ( | 299 | return ( |
136 | 301 | text is not None and isinstance(text, six.string_types) | 300 | text is not None and isinstance(text, str) |
137 | 302 | and len(text.strip()) > 0) | 301 | and len(text.strip()) > 0) |
138 | 303 | 302 | ||
139 | 304 | def decorate(dspr_pubs): | 303 | def decorate(dspr_pubs): |
140 | @@ -341,7 +340,7 @@ class DistributionSourcePackageView(DistributionSourcePackageBaseView, | |||
141 | 341 | """View class for DistributionSourcePackage.""" | 340 | """View class for DistributionSourcePackage.""" |
142 | 342 | 341 | ||
143 | 343 | def initialize(self): | 342 | def initialize(self): |
145 | 344 | super(DistributionSourcePackageView, self).initialize() | 343 | super().initialize() |
146 | 345 | expose_structural_subscription_data_to_js( | 344 | expose_structural_subscription_data_to_js( |
147 | 346 | self.context, self.request, self.user) | 345 | self.context, self.request, self.user) |
148 | 347 | 346 | ||
149 | diff --git a/lib/lp/registry/browser/distroseries.py b/lib/lp/registry/browser/distroseries.py | |||
150 | index 6b162dc..0834c89 100644 | |||
151 | --- a/lib/lp/registry/browser/distroseries.py | |||
152 | +++ b/lib/lp/registry/browser/distroseries.py | |||
153 | @@ -159,7 +159,7 @@ class DistroSeriesURL: | |||
154 | 159 | not self.context.distribution.redirect_default_traversal): | 159 | not self.context.distribution.redirect_default_traversal): |
155 | 160 | return self.context.name | 160 | return self.context.name |
156 | 161 | else: | 161 | else: |
158 | 162 | return u"+series/%s" % self.context.name | 162 | return "+series/%s" % self.context.name |
159 | 163 | 163 | ||
160 | 164 | 164 | ||
161 | 165 | class DistroSeriesNavigation(GetitemNavigation, BugTargetTraversalMixin, | 165 | class DistroSeriesNavigation(GetitemNavigation, BugTargetTraversalMixin, |
162 | @@ -439,7 +439,7 @@ class DistroSeriesView(LaunchpadView, MilestoneOverlayMixin, | |||
163 | 439 | DerivedDistroSeriesMixin): | 439 | DerivedDistroSeriesMixin): |
164 | 440 | 440 | ||
165 | 441 | def initialize(self): | 441 | def initialize(self): |
167 | 442 | super(DistroSeriesView, self).initialize() | 442 | super().initialize() |
168 | 443 | self.displayname = '%s %s' % ( | 443 | self.displayname = '%s %s' % ( |
169 | 444 | self.context.distribution.displayname, | 444 | self.context.distribution.displayname, |
170 | 445 | self.context.version) | 445 | self.context.version) |
171 | @@ -709,7 +709,7 @@ class DistroSeriesAddView(LaunchpadFormView): | |||
172 | 709 | ] | 709 | ] |
173 | 710 | 710 | ||
174 | 711 | help_links = { | 711 | help_links = { |
176 | 712 | "name": u"/+help-registry/distribution-add-series.html#codename", | 712 | "name": "/+help-registry/distribution-add-series.html#codename", |
177 | 713 | } | 713 | } |
178 | 714 | 714 | ||
179 | 715 | label = 'Add a series' | 715 | label = 'Add a series' |
180 | @@ -729,7 +729,7 @@ class DistroSeriesAddView(LaunchpadFormView): | |||
181 | 729 | display_name=data['display_name'], | 729 | display_name=data['display_name'], |
182 | 730 | title=data['display_name'], | 730 | title=data['display_name'], |
183 | 731 | summary=data['summary'], | 731 | summary=data['summary'], |
185 | 732 | description=u"", | 732 | description="", |
186 | 733 | version=data['version'], | 733 | version=data['version'], |
187 | 734 | previous_series=previous_series, | 734 | previous_series=previous_series, |
188 | 735 | registrant=self.user) | 735 | registrant=self.user) |
189 | @@ -765,7 +765,7 @@ class DistroSeriesInitializeView(LaunchpadFormView): | |||
190 | 765 | page_title = label | 765 | page_title = label |
191 | 766 | 766 | ||
192 | 767 | def initialize(self): | 767 | def initialize(self): |
194 | 768 | super(DistroSeriesInitializeView, self).initialize() | 768 | super().initialize() |
195 | 769 | cache = IJSONRequestCache(self.request).objects | 769 | cache = IJSONRequestCache(self.request).objects |
196 | 770 | distribution = self.context.distribution | 770 | distribution = self.context.distribution |
197 | 771 | is_first_derivation = not distribution.has_published_sources | 771 | is_first_derivation = not distribution.has_published_sources |
198 | @@ -778,7 +778,7 @@ class DistroSeriesInitializeView(LaunchpadFormView): | |||
199 | 778 | cache['previous_parents'] = [ | 778 | cache['previous_parents'] = [ |
200 | 779 | seriesToVocab(series) for series in previous_parents] | 779 | seriesToVocab(series) for series in previous_parents] |
201 | 780 | 780 | ||
203 | 781 | @action(u"Initialize Series", name='initialize') | 781 | @action("Initialize Series", name='initialize') |
204 | 782 | def submit(self, action, data): | 782 | def submit(self, action, data): |
205 | 783 | """Stub for the Javascript in the page to use.""" | 783 | """Stub for the Javascript in the page to use.""" |
206 | 784 | 784 | ||
207 | @@ -888,7 +888,7 @@ class IDifferencesFormSchema(Interface): | |||
208 | 888 | required=True) | 888 | required=True) |
209 | 889 | 889 | ||
210 | 890 | sponsored_person = Choice( | 890 | sponsored_person = Choice( |
212 | 891 | title=u"Person being sponsored", vocabulary='ValidPerson', | 891 | title="Person being sponsored", vocabulary='ValidPerson', |
213 | 892 | required=False) | 892 | required=False) |
214 | 893 | 893 | ||
215 | 894 | 894 | ||
216 | @@ -954,7 +954,7 @@ class DistroSeriesDifferenceBaseView(LaunchpadFormView, | |||
217 | 954 | As this field depends on other search/filtering field values | 954 | As this field depends on other search/filtering field values |
218 | 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. |
219 | 956 | """ | 956 | """ |
221 | 957 | super(DistroSeriesDifferenceBaseView, self).setUpFields() | 957 | super().setUpFields() |
222 | 958 | self.form_fields = ( | 958 | self.form_fields = ( |
223 | 959 | self.setupPackageFilterRadio() + | 959 | self.setupPackageFilterRadio() + |
224 | 960 | self.form_fields) | 960 | self.form_fields) |
225 | @@ -1231,7 +1231,7 @@ class DistroSeriesLocalDifferencesView(DistroSeriesDifferenceBaseView, | |||
226 | 1231 | parent_name, | 1231 | parent_name, |
227 | 1232 | self.context.displayname, | 1232 | self.context.displayname, |
228 | 1233 | )) | 1233 | )) |
230 | 1234 | super(DistroSeriesLocalDifferencesView, self).initialize() | 1234 | super().initialize() |
231 | 1235 | 1235 | ||
232 | 1236 | @property | 1236 | @property |
233 | 1237 | def explanation(self): | 1237 | def explanation(self): |
234 | @@ -1294,9 +1294,9 @@ class DistroSeriesLocalDifferencesView(DistroSeriesDifferenceBaseView, | |||
235 | 1294 | copies, self.user, copy_policy=PackageCopyPolicy.MASS_SYNC) | 1294 | copies, self.user, copy_policy=PackageCopyPolicy.MASS_SYNC) |
236 | 1295 | 1295 | ||
237 | 1296 | self.request.response.addInfoNotification( | 1296 | self.request.response.addInfoNotification( |
241 | 1297 | (u"Upgrades of {context.displayname} packages have been " | 1297 | ("Upgrades of {context.displayname} packages have been " |
242 | 1298 | u"requested. Please give Launchpad some time to complete " | 1298 | "requested. Please give Launchpad some time to complete " |
243 | 1299 | u"these.").format(context=self.context)) | 1299 | "these.").format(context=self.context)) |
244 | 1300 | 1300 | ||
245 | 1301 | def canUpgrade(self, action=None): | 1301 | def canUpgrade(self, action=None): |
246 | 1302 | """Should the form offer a packages upgrade?""" | 1302 | """Should the form offer a packages upgrade?""" |
247 | @@ -1330,7 +1330,7 @@ class DistroSeriesMissingPackagesView(DistroSeriesDifferenceBaseView, | |||
248 | 1330 | "Include Selected packages into %s" % ( | 1330 | "Include Selected packages into %s" % ( |
249 | 1331 | self.context.displayname, | 1331 | self.context.displayname, |
250 | 1332 | )) | 1332 | )) |
252 | 1333 | super(DistroSeriesMissingPackagesView, self).initialize() | 1333 | super().initialize() |
253 | 1334 | 1334 | ||
254 | 1335 | @property | 1335 | @property |
255 | 1336 | def explanation(self): | 1336 | def explanation(self): |
256 | @@ -1369,7 +1369,7 @@ class DistroSeriesUniquePackagesView(DistroSeriesDifferenceBaseView, | |||
257 | 1369 | show_packagesets = True | 1369 | show_packagesets = True |
258 | 1370 | 1370 | ||
259 | 1371 | def initialize(self): | 1371 | def initialize(self): |
261 | 1372 | super(DistroSeriesUniquePackagesView, self).initialize() | 1372 | super().initialize() |
262 | 1373 | 1373 | ||
263 | 1374 | @property | 1374 | @property |
264 | 1375 | def explanation(self): | 1375 | def explanation(self): |
265 | diff --git a/lib/lp/registry/browser/distroseriesdifference.py b/lib/lp/registry/browser/distroseriesdifference.py | |||
266 | index 717cb88..ddcd915 100644 | |||
267 | --- a/lib/lp/registry/browser/distroseriesdifference.py | |||
268 | +++ b/lib/lp/registry/browser/distroseriesdifference.py | |||
269 | @@ -258,7 +258,7 @@ class DistroSeriesDifferenceDisplayComment(MessageComment): | |||
270 | 258 | 258 | ||
271 | 259 | def __init__(self, comment): | 259 | def __init__(self, comment): |
272 | 260 | """Setup the attributes required by `IComment`.""" | 260 | """Setup the attributes required by `IComment`.""" |
274 | 261 | super(DistroSeriesDifferenceDisplayComment, self).__init__(None) | 261 | super().__init__(None) |
275 | 262 | self.comment = comment | 262 | self.comment = comment |
276 | 263 | self._message = comment.message | 263 | self._message = comment.message |
277 | 264 | 264 | ||
278 | diff --git a/lib/lp/registry/browser/distroseriesdifferencecomment.py b/lib/lp/registry/browser/distroseriesdifferencecomment.py | |||
279 | index 6d1a8a1..5bb0c86 100644 | |||
280 | --- a/lib/lp/registry/browser/distroseriesdifferencecomment.py | |||
281 | +++ b/lib/lp/registry/browser/distroseriesdifferencecomment.py | |||
282 | @@ -18,7 +18,6 @@ class DistroSeriesDifferenceCommentView(LaunchpadView): | |||
283 | 18 | """ | 18 | """ |
284 | 19 | 19 | ||
285 | 20 | def __init__(self, *args, **kwargs): | 20 | def __init__(self, *args, **kwargs): |
288 | 21 | super(DistroSeriesDifferenceCommentView, self).__init__( | 21 | super().__init__(*args, **kwargs) |
287 | 22 | *args, **kwargs) | ||
289 | 23 | error_persona = getUtility(ILaunchpadCelebrities).janitor | 22 | error_persona = getUtility(ILaunchpadCelebrities).janitor |
290 | 24 | self.is_error = (self.context.comment_author == error_persona) | 23 | self.is_error = (self.context.comment_author == error_persona) |
291 | diff --git a/lib/lp/registry/browser/featuredproject.py b/lib/lp/registry/browser/featuredproject.py | |||
292 | index c77adcb..214eede 100644 | |||
293 | --- a/lib/lp/registry/browser/featuredproject.py | |||
294 | +++ b/lib/lp/registry/browser/featuredproject.py | |||
295 | @@ -34,7 +34,7 @@ class FeaturedProjectForm(Interface): | |||
296 | 34 | required=False, vocabulary='DistributionOrProductOrProjectGroup') | 34 | required=False, vocabulary='DistributionOrProductOrProjectGroup') |
297 | 35 | 35 | ||
298 | 36 | remove = Set( | 36 | remove = Set( |
300 | 37 | title=u'Remove projects', | 37 | title='Remove projects', |
301 | 38 | description=_( | 38 | description=_( |
302 | 39 | 'Select projects that you would like to remove from the list.'), | 39 | 'Select projects that you would like to remove from the list.'), |
303 | 40 | required=False, | 40 | required=False, |
304 | diff --git a/lib/lp/registry/browser/mailinglists.py b/lib/lp/registry/browser/mailinglists.py | |||
305 | index ea8c6ed..bbc26a2 100644 | |||
306 | --- a/lib/lp/registry/browser/mailinglists.py | |||
307 | +++ b/lib/lp/registry/browser/mailinglists.py | |||
308 | @@ -28,7 +28,7 @@ class HeldMessageView(LaunchpadView): | |||
309 | 28 | """A little helper view for held messages.""" | 28 | """A little helper view for held messages.""" |
310 | 29 | 29 | ||
311 | 30 | def __init__(self, context, request): | 30 | def __init__(self, context, request): |
313 | 31 | super(HeldMessageView, self).__init__(context, request) | 31 | super().__init__(context, request) |
314 | 32 | self.context = context | 32 | self.context = context |
315 | 33 | self.request = request | 33 | self.request = request |
316 | 34 | # The context object is an IMessageApproval, but we need some extra | 34 | # The context object is an IMessageApproval, but we need some extra |
317 | @@ -74,16 +74,16 @@ class HeldMessageView(LaunchpadView): | |||
318 | 74 | else: | 74 | else: |
319 | 75 | current_paragraph.append(line) | 75 | current_paragraph.append(line) |
320 | 76 | self._append_paragraph(paragraphs, current_paragraph) | 76 | self._append_paragraph(paragraphs, current_paragraph) |
322 | 77 | self.body_details = u''.join(paragraphs) | 77 | self.body_details = ''.join(paragraphs) |
323 | 78 | 78 | ||
324 | 79 | def _append_paragraph(self, paragraphs, current_paragraph): | 79 | def _append_paragraph(self, paragraphs, current_paragraph): |
325 | 80 | if len(current_paragraph) == 0: | 80 | if len(current_paragraph) == 0: |
326 | 81 | # There is nothing to append. The message has multiple | 81 | # There is nothing to append. The message has multiple |
327 | 82 | # blank lines. | 82 | # blank lines. |
328 | 83 | return | 83 | return |
332 | 84 | paragraphs.append(u'\n<p>\n') | 84 | paragraphs.append('\n<p>\n') |
333 | 85 | paragraphs.append(u'\n'.join(current_paragraph)) | 85 | paragraphs.append('\n'.join(current_paragraph)) |
334 | 86 | paragraphs.append(u'\n</p>\n') | 86 | paragraphs.append('\n</p>\n') |
335 | 87 | 87 | ||
336 | 88 | def _remove_leading_blank_lines(self): | 88 | def _remove_leading_blank_lines(self): |
337 | 89 | """Strip off any leading blank lines. | 89 | """Strip off any leading blank lines. |
338 | @@ -113,13 +113,13 @@ class HeldMessageView(LaunchpadView): | |||
339 | 113 | """ | 113 | """ |
340 | 114 | # If there are no non-blank lines, then we're done. | 114 | # If there are no non-blank lines, then we're done. |
341 | 115 | if len(text_lines) == 0: | 115 | if len(text_lines) == 0: |
344 | 116 | self.body_summary = u'' | 116 | self.body_summary = '' |
345 | 117 | return u'' | 117 | return '' |
346 | 118 | # If the first line is of a completely arbitrarily chosen reasonable | 118 | # If the first line is of a completely arbitrarily chosen reasonable |
347 | 119 | # length, then we'll just use that as the summary. | 119 | # length, then we'll just use that as the summary. |
348 | 120 | elif len(text_lines[0]) < 60: | 120 | elif len(text_lines[0]) < 60: |
349 | 121 | self.body_summary = text_lines[0] | 121 | self.body_summary = text_lines[0] |
351 | 122 | return u'\n'.join(text_lines[1:]) | 122 | return '\n'.join(text_lines[1:]) |
352 | 123 | # It could be the case that the text is actually flowed using RFC | 123 | # It could be the case that the text is actually flowed using RFC |
353 | 124 | # 3676 format="flowed" parameters. In that case, just split the line | 124 | # 3676 format="flowed" parameters. In that case, just split the line |
354 | 125 | # at the first whitespace after, again, our arbitrarily chosen limit. | 125 | # at the first whitespace after, again, our arbitrarily chosen limit. |
355 | @@ -128,8 +128,8 @@ class HeldMessageView(LaunchpadView): | |||
356 | 128 | wrapper = TextWrapper(width=60) | 128 | wrapper = TextWrapper(width=60) |
357 | 129 | filled_lines = wrapper.fill(first_line).splitlines() | 129 | filled_lines = wrapper.fill(first_line).splitlines() |
358 | 130 | self.body_summary = filled_lines[0] | 130 | self.body_summary = filled_lines[0] |
361 | 131 | text_lines.insert(0, u''.join(filled_lines[1:])) | 131 | text_lines.insert(0, ''.join(filled_lines[1:])) |
362 | 132 | return u'\n'.join(text_lines) | 132 | return '\n'.join(text_lines) |
363 | 133 | 133 | ||
364 | 134 | 134 | ||
365 | 135 | class enabled_with_active_mailing_list: | 135 | class enabled_with_active_mailing_list: |
366 | diff --git a/lib/lp/registry/browser/milestone.py b/lib/lp/registry/browser/milestone.py | |||
367 | index 3d2724e..375f5e4 100644 | |||
368 | --- a/lib/lp/registry/browser/milestone.py | |||
369 | +++ b/lib/lp/registry/browser/milestone.py | |||
370 | @@ -194,7 +194,7 @@ class MilestoneInlineNavigationMenu(NavigationMenu, MilestoneLinkMixin): | |||
371 | 194 | links = ('edit', ) | 194 | links = ('edit', ) |
372 | 195 | 195 | ||
373 | 196 | 196 | ||
375 | 197 | class MilestoneViewMixin(object): | 197 | class MilestoneViewMixin: |
376 | 198 | """Common methods shared between MilestoneView and MilestoneTagView.""" | 198 | """Common methods shared between MilestoneView and MilestoneTagView.""" |
377 | 199 | 199 | ||
378 | 200 | @property | 200 | @property |
379 | @@ -366,7 +366,7 @@ class MilestoneView( | |||
380 | 366 | :param context: `IMilestone` or `IProductRelease`. | 366 | :param context: `IMilestone` or `IProductRelease`. |
381 | 367 | :param request: `ILaunchpadRequest`. | 367 | :param request: `ILaunchpadRequest`. |
382 | 368 | """ | 368 | """ |
384 | 369 | super(MilestoneView, self).__init__(context, request) | 369 | super().__init__(context, request) |
385 | 370 | if IMilestoneData.providedBy(context): | 370 | if IMilestoneData.providedBy(context): |
386 | 371 | self.milestone = context | 371 | self.milestone = context |
387 | 372 | self.release = getattr(context, "product_release", None) | 372 | self.release = getattr(context, "product_release", None) |
388 | @@ -431,7 +431,7 @@ class MilestoneTagBase: | |||
389 | 431 | on the interface. | 431 | on the interface. |
390 | 432 | """ | 432 | """ |
391 | 433 | tag_entry = TextLine( | 433 | tag_entry = TextLine( |
393 | 434 | __name__='tags', title=u'Tags', required=False, | 434 | __name__='tags', title='Tags', required=False, |
394 | 435 | constraint=lambda value: validate_tags(value.split())) | 435 | constraint=lambda value: validate_tags(value.split())) |
395 | 436 | self.form_fields += form.Fields( | 436 | self.form_fields += form.Fields( |
396 | 437 | tag_entry, render_context=self.render_context) | 437 | tag_entry, render_context=self.render_context) |
397 | @@ -512,7 +512,7 @@ class MilestoneEditView(MilestoneTagBase, LaunchpadEditFormView): | |||
398 | 512 | 512 | ||
399 | 513 | @property | 513 | @property |
400 | 514 | def initial_values(self): | 514 | def initial_values(self): |
402 | 515 | return {'tags': u' '.join(self.context.getTags())} | 515 | return {'tags': ' '.join(self.context.getTags())} |
403 | 516 | 516 | ||
404 | 517 | def setUpFields(self): | 517 | def setUpFields(self): |
405 | 518 | """See `LaunchpadFormView`. | 518 | """See `LaunchpadFormView`. |
406 | @@ -521,7 +521,7 @@ class MilestoneEditView(MilestoneTagBase, LaunchpadEditFormView): | |||
407 | 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. |
408 | 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. |
409 | 523 | """ | 523 | """ |
411 | 524 | super(MilestoneEditView, self).setUpFields() | 524 | super().setUpFields() |
412 | 525 | if self.context.product is None: | 525 | if self.context.product is None: |
413 | 526 | # This is a distribution milestone. | 526 | # This is a distribution milestone. |
414 | 527 | choice = Choice( | 527 | choice = Choice( |
415 | @@ -538,7 +538,7 @@ class MilestoneEditView(MilestoneTagBase, LaunchpadEditFormView): | |||
416 | 538 | @action(_('Update'), name='update') | 538 | @action(_('Update'), name='update') |
417 | 539 | def update_action(self, action, data): | 539 | def update_action(self, action, data): |
418 | 540 | """Update the milestone.""" | 540 | """Update the milestone.""" |
420 | 541 | tags = data.pop('tags') or u'' | 541 | tags = data.pop('tags') or '' |
421 | 542 | self.updateContextFromData(data) | 542 | self.updateContextFromData(data) |
422 | 543 | self.context.setTags(tags.lower().split(), self.user) | 543 | self.context.setTags(tags.lower().split(), self.user) |
423 | 544 | self.next_url = canonical_url(self.context) | 544 | self.next_url = canonical_url(self.context) |
424 | @@ -611,17 +611,17 @@ class MilestoneTagView( | |||
425 | 611 | :param context: `IProjectGroupMilestoneTag` | 611 | :param context: `IProjectGroupMilestoneTag` |
426 | 612 | :param request: `ILaunchpadRequest`. | 612 | :param request: `ILaunchpadRequest`. |
427 | 613 | """ | 613 | """ |
429 | 614 | super(MilestoneTagView, self).__init__(context, request) | 614 | super().__init__(context, request) |
430 | 615 | self.context = self.milestone = context | 615 | self.context = self.milestone = context |
431 | 616 | self.release = None | 616 | self.release = None |
432 | 617 | 617 | ||
433 | 618 | @property | 618 | @property |
434 | 619 | def initial_values(self): | 619 | def initial_values(self): |
435 | 620 | """Set the initial value of the search tags field.""" | 620 | """Set the initial value of the search tags field.""" |
437 | 621 | return {'tags': u' '.join(self.context.tags)} | 621 | return {'tags': ' '.join(self.context.tags)} |
438 | 622 | 622 | ||
439 | 623 | @safe_action | 623 | @safe_action |
441 | 624 | @action(u'Search Milestone Tags', name='search') | 624 | @action('Search Milestone Tags', name='search') |
442 | 625 | def search_by_tags(self, action, data): | 625 | def search_by_tags(self, action, data): |
443 | 626 | tags = data['tags'].split() | 626 | tags = data['tags'].split() |
444 | 627 | milestone_tag = ProjectGroupMilestoneTag(self.context.target, tags) | 627 | milestone_tag = ProjectGroupMilestoneTag(self.context.target, tags) |
445 | diff --git a/lib/lp/registry/browser/objectreassignment.py b/lib/lp/registry/browser/objectreassignment.py | |||
446 | index 79c0ddf..014f9a2 100644 | |||
447 | --- a/lib/lp/registry/browser/objectreassignment.py | |||
448 | +++ b/lib/lp/registry/browser/objectreassignment.py | |||
449 | @@ -72,7 +72,7 @@ class ObjectReassignmentView(LaunchpadFormView): | |||
450 | 72 | page_title = label | 72 | page_title = label |
451 | 73 | 73 | ||
452 | 74 | def setUpFields(self): | 74 | def setUpFields(self): |
454 | 75 | super(ObjectReassignmentView, self).setUpFields() | 75 | super().setUpFields() |
455 | 76 | self.form_fields = FormFields( | 76 | self.form_fields = FormFields( |
456 | 77 | self.form_fields, self.auto_create_team_field) | 77 | self.form_fields, self.auto_create_team_field) |
457 | 78 | 78 | ||
458 | diff --git a/lib/lp/registry/browser/ociproject.py b/lib/lp/registry/browser/ociproject.py | |||
459 | index 55f2d61..85a1c00 100644 | |||
460 | --- a/lib/lp/registry/browser/ociproject.py | |||
461 | +++ b/lib/lp/registry/browser/ociproject.py | |||
462 | @@ -93,7 +93,7 @@ class OCIProjectURL: | |||
463 | 93 | if (policy == DistributionDefaultTraversalPolicy.OCI_PROJECT and | 93 | if (policy == DistributionDefaultTraversalPolicy.OCI_PROJECT and |
464 | 94 | not self.context.distribution.redirect_default_traversal): | 94 | not self.context.distribution.redirect_default_traversal): |
465 | 95 | return self.context.name | 95 | return self.context.name |
467 | 96 | return u"+oci/%s" % self.context.name | 96 | return "+oci/%s" % self.context.name |
468 | 97 | 97 | ||
469 | 98 | 98 | ||
470 | 99 | def getPillarFieldName(pillar): | 99 | def getPillarFieldName(pillar): |
471 | @@ -114,7 +114,7 @@ class OCIProjectAddView(LaunchpadFormView): | |||
472 | 114 | if (not getFeatureFlag(OCI_PROJECT_ALLOW_CREATE) and not | 114 | if (not getFeatureFlag(OCI_PROJECT_ALLOW_CREATE) and not |
473 | 115 | self.context.canAdministerOCIProjects(self.user)): | 115 | self.context.canAdministerOCIProjects(self.user)): |
474 | 116 | raise OCIProjectCreateFeatureDisabled | 116 | raise OCIProjectCreateFeatureDisabled |
476 | 117 | super(OCIProjectAddView, self).initialize() | 117 | super().initialize() |
477 | 118 | 118 | ||
478 | 119 | @action("Create OCI Project", name="create") | 119 | @action("Create OCI Project", name="create") |
479 | 120 | def create_action(self, action, data): | 120 | def create_action(self, action, data): |
480 | @@ -129,7 +129,7 @@ class OCIProjectAddView(LaunchpadFormView): | |||
481 | 129 | self.next_url = canonical_url(oci_project) | 129 | self.next_url = canonical_url(oci_project) |
482 | 130 | 130 | ||
483 | 131 | def validate(self, data): | 131 | def validate(self, data): |
485 | 132 | super(OCIProjectAddView, self).validate(data) | 132 | super().validate(data) |
486 | 133 | name = data.get('name', None) | 133 | name = data.get('name', None) |
487 | 134 | oci_project_name = getUtility( | 134 | oci_project_name = getUtility( |
488 | 135 | IOCIProjectNameSet).getOrCreateByName(name) | 135 | IOCIProjectNameSet).getOrCreateByName(name) |
489 | @@ -289,7 +289,7 @@ class OCIProjectEditView(LaunchpadEditFormView): | |||
490 | 289 | pillar_key = getPillarFieldName(self.context.pillar) | 289 | pillar_key = getPillarFieldName(self.context.pillar) |
491 | 290 | self.field_names = [pillar_key] + self.field_names | 290 | self.field_names = [pillar_key] + self.field_names |
492 | 291 | 291 | ||
494 | 292 | super(OCIProjectEditView, self).setUpFields() | 292 | super().setUpFields() |
495 | 293 | 293 | ||
496 | 294 | # Set the correct pillar field as mandatory | 294 | # Set the correct pillar field as mandatory |
497 | 295 | pillar_field = self.form_fields.get(pillar_key).field | 295 | pillar_field = self.form_fields.get(pillar_key).field |
498 | @@ -302,7 +302,7 @@ class OCIProjectEditView(LaunchpadEditFormView): | |||
499 | 302 | page_title = 'Edit' | 302 | page_title = 'Edit' |
500 | 303 | 303 | ||
501 | 304 | def validate(self, data): | 304 | def validate(self, data): |
503 | 305 | super(OCIProjectEditView, self).validate(data) | 305 | super().validate(data) |
504 | 306 | pillar_type_field = getPillarFieldName(self.context.pillar) | 306 | pillar_type_field = getPillarFieldName(self.context.pillar) |
505 | 307 | pillar = data.get(pillar_type_field) | 307 | pillar = data.get(pillar_type_field) |
506 | 308 | name = data.get('name') | 308 | name = data.get('name') |
507 | diff --git a/lib/lp/registry/browser/peoplemerge.py b/lib/lp/registry/browser/peoplemerge.py | |||
508 | index eb15d67..f37f6da 100644 | |||
509 | --- a/lib/lp/registry/browser/peoplemerge.py | |||
510 | +++ b/lib/lp/registry/browser/peoplemerge.py | |||
511 | @@ -123,7 +123,7 @@ class AdminMergeBaseView(ValidatingMergeView): | |||
512 | 123 | # only in certain circunstances, so don't include them in the list of | 123 | # only in certain circunstances, so don't include them in the list of |
513 | 124 | # actions to be rendered. | 124 | # actions to be rendered. |
514 | 125 | self.actions = [self.merge_action] | 125 | self.actions = [self.merge_action] |
516 | 126 | return super(AdminMergeBaseView, self).render() | 126 | return super().render() |
517 | 127 | 127 | ||
518 | 128 | def setUpPeople(self, data): | 128 | def setUpPeople(self, data): |
519 | 129 | """Store the people to be merged in instance variables. | 129 | """Store the people to be merged in instance variables. |
520 | @@ -224,7 +224,7 @@ class AdminTeamMergeView(AdminMergeBaseView): | |||
521 | 224 | if len(self.errors) > 0: | 224 | if len(self.errors) > 0: |
522 | 225 | return | 225 | return |
523 | 226 | 226 | ||
525 | 227 | super(AdminTeamMergeView, self).validate(data) | 227 | super().validate(data) |
526 | 228 | dupe_team = data['dupe_person'] | 228 | dupe_team = data['dupe_person'] |
527 | 229 | # We cannot merge the teams if there is a mailing list on the | 229 | # We cannot merge the teams if there is a mailing list on the |
528 | 230 | # duplicate person, unless that mailing list is purged. | 230 | # duplicate person, unless that mailing list is purged. |
529 | @@ -248,14 +248,14 @@ class AdminTeamMergeView(AdminMergeBaseView): | |||
530 | 248 | # merge. | 248 | # merge. |
531 | 249 | self.should_confirm_member_deactivation = True | 249 | self.should_confirm_member_deactivation = True |
532 | 250 | return | 250 | return |
534 | 251 | super(AdminTeamMergeView, self).doMerge(data) | 251 | super().doMerge(data) |
535 | 252 | 252 | ||
536 | 253 | @action('Deactivate Members and Merge', | 253 | @action('Deactivate Members and Merge', |
537 | 254 | name='deactivate_members_and_merge') | 254 | name='deactivate_members_and_merge') |
538 | 255 | def deactivate_members_and_merge_action(self, action, data): | 255 | def deactivate_members_and_merge_action(self, action, data): |
539 | 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.""" |
540 | 257 | self.setUpPeople(data) | 257 | self.setUpPeople(data) |
542 | 258 | super(AdminTeamMergeView, self).doMerge(data) | 258 | super().doMerge(data) |
543 | 259 | 259 | ||
544 | 260 | 260 | ||
545 | 261 | class DeleteTeamView(AdminTeamMergeView): | 261 | class DeleteTeamView(AdminTeamMergeView): |
546 | @@ -270,7 +270,7 @@ class DeleteTeamView(AdminTeamMergeView): | |||
547 | 270 | return 'Delete %s' % self.context.displayname | 270 | return 'Delete %s' % self.context.displayname |
548 | 271 | 271 | ||
549 | 272 | def __init__(self, context, request): | 272 | def __init__(self, context, request): |
551 | 273 | super(DeleteTeamView, self).__init__(context, request) | 273 | super().__init__(context, request) |
552 | 274 | if ('field.dupe_person' in self.request.form): | 274 | if ('field.dupe_person' in self.request.form): |
553 | 275 | # These fields have fixed values and are managed by this method. | 275 | # These fields have fixed values and are managed by this method. |
554 | 276 | # The user has crafted a request to gain ownership of the dupe | 276 | # The user has crafted a request to gain ownership of the dupe |
555 | @@ -311,9 +311,8 @@ class DeleteTeamView(AdminTeamMergeView): | |||
556 | 311 | 311 | ||
557 | 312 | @action('Delete', name='delete', condition=canDelete) | 312 | @action('Delete', name='delete', condition=canDelete) |
558 | 313 | def merge_action(self, action, data): | 313 | def merge_action(self, action, data): |
559 | 314 | base = super(DeleteTeamView, self) | ||
560 | 315 | self.delete = True | 314 | self.delete = True |
562 | 316 | base.deactivate_members_and_merge_action.success(data) | 315 | super().deactivate_members_and_merge_action.success(data) |
563 | 317 | 316 | ||
564 | 318 | 317 | ||
565 | 319 | class FinishedPeopleMergeRequestView(LaunchpadView): | 318 | class FinishedPeopleMergeRequestView(LaunchpadView): |
566 | @@ -361,8 +360,7 @@ class RequestPeopleMergeMultipleEmailsView(LaunchpadView): | |||
567 | 361 | page_title = label | 360 | page_title = label |
568 | 362 | 361 | ||
569 | 363 | def __init__(self, context, request): | 362 | def __init__(self, context, request): |
572 | 364 | super(RequestPeopleMergeMultipleEmailsView, self).__init__( | 363 | super().__init__(context, request) |
571 | 365 | context, request) | ||
573 | 366 | self.form_processed = False | 364 | self.form_processed = False |
574 | 367 | self.dupe = None | 365 | self.dupe = None |
575 | 368 | self.notified_addresses = [] | 366 | self.notified_addresses = [] |
576 | diff --git a/lib/lp/registry/browser/person.py b/lib/lp/registry/browser/person.py | |||
577 | index 7cf2fcb..ccd09c7 100644 | |||
578 | --- a/lib/lp/registry/browser/person.py | |||
579 | +++ b/lib/lp/registry/browser/person.py | |||
580 | @@ -65,7 +65,6 @@ from lazr.restful.interfaces import IWebServiceClientRequest | |||
581 | 65 | from lazr.restful.utils import smartquote | 65 | from lazr.restful.utils import smartquote |
582 | 66 | from lazr.uri import URI | 66 | from lazr.uri import URI |
583 | 67 | import pytz | 67 | import pytz |
584 | 68 | import six | ||
585 | 69 | from six.moves.urllib.parse import ( | 68 | from six.moves.urllib.parse import ( |
586 | 70 | quote, | 69 | quote, |
587 | 71 | urlencode, | 70 | urlencode, |
588 | @@ -470,7 +469,7 @@ class BranchTraversalMixin: | |||
589 | 470 | branch = getUtility(IBranchNamespaceSet).traverse( | 469 | branch = getUtility(IBranchNamespaceSet).traverse( |
590 | 471 | self._getSegments(pillar_name)) | 470 | self._getSegments(pillar_name)) |
591 | 472 | except (NotFoundError, InvalidNamespace): | 471 | except (NotFoundError, InvalidNamespace): |
593 | 473 | return super(BranchTraversalMixin, self).traverse(pillar_name) | 472 | return super().traverse(pillar_name) |
594 | 474 | 473 | ||
595 | 475 | # Normally, populating the launch bag is done by the traversal | 474 | # Normally, populating the launch bag is done by the traversal |
596 | 476 | # mechanism. However, here we short-circuit that mechanism by | 475 | # mechanism. However, here we short-circuit that mechanism by |
597 | @@ -905,8 +904,8 @@ class PersonOverviewMenu(ApplicationMenu, PersonMenuMixin, HasRecipesMenuMixin, | |||
598 | 905 | target = '+karma' | 904 | target = '+karma' |
599 | 906 | text = 'Show karma summary' | 905 | text = 'Show karma summary' |
600 | 907 | summary = ( | 906 | summary = ( |
603 | 908 | u'%s\N{right single quotation mark}s activities ' | 907 | '%s\N{right single quotation mark}s activities ' |
604 | 909 | u'in Launchpad' % self.context.displayname) | 908 | 'in Launchpad' % self.context.displayname) |
605 | 910 | return Link(target, text, summary, icon='info') | 909 | return Link(target, text, summary, icon='info') |
606 | 911 | 910 | ||
607 | 912 | def memberships(self): | 911 | def memberships(self): |
608 | @@ -1034,7 +1033,7 @@ class PeopleSearchView(LaunchpadView): | |||
609 | 1034 | page_title = 'People and teams in Launchpad' | 1033 | page_title = 'People and teams in Launchpad' |
610 | 1035 | 1034 | ||
611 | 1036 | def __init__(self, context, request): | 1035 | def __init__(self, context, request): |
613 | 1037 | super(PeopleSearchView, self).__init__(context, request) | 1036 | super().__init__(context, request) |
614 | 1038 | self.results = [] | 1037 | self.results = [] |
615 | 1039 | 1038 | ||
616 | 1040 | @property | 1039 | @property |
617 | @@ -1092,7 +1091,7 @@ class PersonDeactivateAccountView(LaunchpadFormView): | |||
618 | 1092 | getUtility(IPersonDeactivateJobSource).create(self.context) | 1091 | getUtility(IPersonDeactivateJobSource).create(self.context) |
619 | 1093 | logoutPerson(self.request) | 1092 | logoutPerson(self.request) |
620 | 1094 | self.request.response.addInfoNotification( | 1093 | self.request.response.addInfoNotification( |
622 | 1095 | _(u'Your account has been deactivated.')) | 1094 | _('Your account has been deactivated.')) |
623 | 1096 | self.next_url = self.request.getApplicationURL() | 1095 | self.next_url = self.request.getApplicationURL() |
624 | 1097 | 1096 | ||
625 | 1098 | 1097 | ||
626 | @@ -1237,7 +1236,7 @@ class PersonRenameFormMixin(LaunchpadEditFormView): | |||
627 | 1237 | if reason: | 1236 | if reason: |
628 | 1238 | # This makes the field's widget display (i.e. read) only. | 1237 | # This makes the field's widget display (i.e. read) only. |
629 | 1239 | self.form_fields['name'].for_display = True | 1238 | self.form_fields['name'].for_display = True |
631 | 1240 | super(PersonRenameFormMixin, self).setUpWidgets() | 1239 | super().setUpWidgets() |
632 | 1241 | if reason: | 1240 | if reason: |
633 | 1242 | self.widgets['name'].hint = reason | 1241 | self.widgets['name'].hint = reason |
634 | 1243 | 1242 | ||
635 | @@ -1319,7 +1318,7 @@ class PersonAccountAdministerView(LaunchpadFormView): | |||
636 | 1319 | 1318 | ||
637 | 1320 | def __init__(self, context, request): | 1319 | def __init__(self, context, request): |
638 | 1321 | """See `LaunchpadEditFormView`.""" | 1320 | """See `LaunchpadEditFormView`.""" |
640 | 1322 | super(PersonAccountAdministerView, self).__init__(context, request) | 1321 | super().__init__(context, request) |
641 | 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. |
642 | 1324 | # It also means that permissions are checked on IAccount, not IPerson. | 1323 | # It also means that permissions are checked on IAccount, not IPerson. |
643 | 1325 | self.person = self.context | 1324 | self.person = self.context |
644 | @@ -1376,18 +1375,18 @@ class PersonAccountAdministerView(LaunchpadFormView): | |||
645 | 1376 | # is sent to the user. | 1375 | # is sent to the user. |
646 | 1377 | self.person.setPreferredEmail(None) | 1376 | self.person.setPreferredEmail(None) |
647 | 1378 | self.request.response.addInfoNotification( | 1377 | self.request.response.addInfoNotification( |
649 | 1379 | u'The account "%s" has been suspended.' | 1378 | 'The account "%s" has been suspended.' |
650 | 1380 | % self.context.displayname) | 1379 | % self.context.displayname) |
651 | 1381 | elif data['status'] == AccountStatus.DEACTIVATED: | 1380 | elif data['status'] == AccountStatus.DEACTIVATED: |
652 | 1382 | self.request.response.addInfoNotification( | 1381 | self.request.response.addInfoNotification( |
655 | 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 ' |
656 | 1384 | u'to reactivate it.' % self.context.displayname) | 1383 | 'to reactivate it.' % self.context.displayname) |
657 | 1385 | elif data['status'] == AccountStatus.DECEASED: | 1384 | elif data['status'] == AccountStatus.DECEASED: |
658 | 1386 | # Deliberately leave the email address in place so that it can't | 1385 | # Deliberately leave the email address in place so that it can't |
659 | 1387 | # easily be claimed by somebody else. | 1386 | # easily be claimed by somebody else. |
660 | 1388 | self.request.response.addInfoNotification( | 1387 | self.request.response.addInfoNotification( |
663 | 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 ' |
664 | 1390 | u'deceased user.' % self.context.displayname) | 1389 | 'deceased user.' % self.context.displayname) |
665 | 1391 | self.context.setStatus(data['status'], self.user, data['comment']) | 1390 | self.context.setStatus(data['status'], self.user, data['comment']) |
666 | 1392 | 1391 | ||
667 | 1393 | 1392 | ||
668 | @@ -1464,7 +1463,7 @@ class PersonLanguagesView(LaunchpadFormView): | |||
669 | 1464 | new_languages = [] | 1463 | new_languages = [] |
670 | 1465 | 1464 | ||
671 | 1466 | for key in all_languages.keys(): | 1465 | for key in all_languages.keys(): |
673 | 1467 | if self.request.get(key, None) == u'on': | 1466 | if self.request.get(key, None) == 'on': |
674 | 1468 | new_languages.append(all_languages[key]) | 1467 | new_languages.append(all_languages[key]) |
675 | 1469 | 1468 | ||
676 | 1470 | if self.is_current_user: | 1469 | if self.is_current_user: |
677 | @@ -2128,7 +2127,7 @@ class PersonIndexView(XRDSContentNegotiationMixin, PersonView, | |||
678 | 2128 | "../../services/openid/templates/person-xrds.pt") | 2127 | "../../services/openid/templates/person-xrds.pt") |
679 | 2129 | 2128 | ||
680 | 2130 | def initialize(self): | 2129 | def initialize(self): |
682 | 2131 | super(PersonIndexView, self).initialize() | 2130 | super().initialize() |
683 | 2132 | if self.context.isMergePending(): | 2131 | if self.context.isMergePending(): |
684 | 2133 | if self.context.is_team: | 2132 | if self.context.is_team: |
685 | 2134 | merge_action = 'merged or deleted' | 2133 | merge_action = 'merged or deleted' |
686 | @@ -2225,7 +2224,7 @@ class PersonCodeOfConductEditView(LaunchpadView): | |||
687 | 2225 | for sig_id in sig_ids: | 2224 | for sig_id in sig_ids: |
688 | 2226 | sig_id = int(sig_id) | 2225 | sig_id = int(sig_id) |
689 | 2227 | # Deactivating signature. | 2226 | # Deactivating signature. |
691 | 2228 | comment = u'Deactivated by Owner' | 2227 | comment = 'Deactivated by Owner' |
692 | 2229 | sCoC_util.modifySignature(sig_id, self.user, comment, False) | 2228 | sCoC_util.modifySignature(sig_id, self.user, comment, False) |
693 | 2230 | 2229 | ||
694 | 2231 | 2230 | ||
695 | @@ -2285,7 +2284,7 @@ class PersonEditJabberIDsView(LaunchpadFormView): | |||
696 | 2285 | field_names = ['jabberid'] | 2284 | field_names = ['jabberid'] |
697 | 2286 | 2285 | ||
698 | 2287 | def setUpFields(self): | 2286 | def setUpFields(self): |
700 | 2288 | super(PersonEditJabberIDsView, self).setUpFields() | 2287 | super().setUpFields() |
701 | 2289 | if not self.context.jabberids.is_empty(): | 2288 | if not self.context.jabberids.is_empty(): |
702 | 2290 | # Make the jabberid entry optional on the edit page if one or more | 2289 | # Make the jabberid entry optional on the edit page if one or more |
703 | 2291 | # ids already exist, which allows the removal of ids without | 2290 | # ids already exist, which allows the removal of ids without |
704 | @@ -2422,7 +2421,7 @@ class PersonGPGView(LaunchpadView): | |||
705 | 2422 | 2421 | ||
706 | 2423 | def initialize(self): | 2422 | def initialize(self): |
707 | 2424 | require_fresh_login(self.request, self.context, '+editpgpkeys') | 2423 | require_fresh_login(self.request, self.context, '+editpgpkeys') |
709 | 2425 | super(PersonGPGView, self).initialize() | 2424 | super().initialize() |
710 | 2426 | 2425 | ||
711 | 2427 | @property | 2426 | @property |
712 | 2428 | def cancel_url(self): | 2427 | def cancel_url(self): |
713 | @@ -2725,7 +2724,7 @@ class PersonEditEmailsView(LaunchpadFormView): | |||
714 | 2725 | # +editemails is not available on teams. | 2724 | # +editemails is not available on teams. |
715 | 2726 | name = self.request['PATH_INFO'].split('/')[-1] | 2725 | name = self.request['PATH_INFO'].split('/')[-1] |
716 | 2727 | raise NotFound(self, name, request=self.request) | 2726 | raise NotFound(self, name, request=self.request) |
718 | 2728 | super(PersonEditEmailsView, self).initialize() | 2727 | super().initialize() |
719 | 2729 | 2728 | ||
720 | 2730 | def setUpFields(self): | 2729 | def setUpFields(self): |
721 | 2731 | """Set up fields for this view. | 2730 | """Set up fields for this view. |
722 | @@ -2734,11 +2733,11 @@ class PersonEditEmailsView(LaunchpadFormView): | |||
723 | 2734 | vocabularies for the lists of validated and unvalidated email | 2733 | vocabularies for the lists of validated and unvalidated email |
724 | 2735 | addresses. | 2734 | addresses. |
725 | 2736 | """ | 2735 | """ |
727 | 2737 | super(PersonEditEmailsView, self).setUpFields() | 2736 | super().setUpFields() |
728 | 2738 | self.form_fields = (self._validated_emails_field() + | 2737 | self.form_fields = (self._validated_emails_field() + |
729 | 2739 | self._unvalidated_emails_field() + | 2738 | self._unvalidated_emails_field() + |
730 | 2740 | FormFields(TextLine(__name__='newemail', | 2739 | FormFields(TextLine(__name__='newemail', |
732 | 2741 | title=u'Add a new address'))) | 2740 | title='Add a new address'))) |
733 | 2742 | 2741 | ||
734 | 2743 | @property | 2742 | @property |
735 | 2744 | def initial_values(self): | 2743 | def initial_values(self): |
736 | @@ -2786,7 +2785,7 @@ class PersonEditEmailsView(LaunchpadFormView): | |||
737 | 2786 | """ | 2785 | """ |
738 | 2787 | terms = [] | 2786 | terms = [] |
739 | 2788 | for term in self.unvalidated_addresses: | 2787 | for term in self.unvalidated_addresses: |
741 | 2789 | if isinstance(term, six.text_type): | 2788 | if isinstance(term, str): |
742 | 2790 | term = SimpleTerm(term) | 2789 | term = SimpleTerm(term) |
743 | 2791 | else: | 2790 | else: |
744 | 2792 | term = SimpleTerm(term, term.email) | 2791 | term = SimpleTerm(term, term.email) |
745 | @@ -2827,7 +2826,7 @@ class PersonEditEmailsView(LaunchpadFormView): | |||
746 | 2827 | "self.context.id(%s,%d) (%s)" | 2826 | "self.context.id(%s,%d) (%s)" |
747 | 2828 | % (person.name, person.id, self.context.name, self.context.id, | 2827 | % (person.name, person.id, self.context.name, self.context.id, |
748 | 2829 | email.email)) | 2828 | email.email)) |
750 | 2830 | elif isinstance(email, six.text_type): | 2829 | elif isinstance(email, str): |
751 | 2831 | tokenset = getUtility(ILoginTokenSet) | 2830 | tokenset = getUtility(ILoginTokenSet) |
752 | 2832 | email = tokenset.searchByEmailRequesterAndType( | 2831 | email = tokenset.searchByEmailRequesterAndType( |
753 | 2833 | email, self.context, LoginTokenType.VALIDATEEMAIL) | 2832 | email, self.context, LoginTokenType.VALIDATEEMAIL) |
754 | @@ -2953,7 +2952,7 @@ class PersonEditEmailsView(LaunchpadFormView): | |||
755 | 2953 | if IEmailAddress.providedBy(emailaddress): | 2952 | if IEmailAddress.providedBy(emailaddress): |
756 | 2954 | emailaddress.destroySelf() | 2953 | emailaddress.destroySelf() |
757 | 2955 | email = emailaddress.email | 2954 | email = emailaddress.email |
759 | 2956 | elif isinstance(emailaddress, six.text_type): | 2955 | elif isinstance(emailaddress, str): |
760 | 2957 | logintokenset = getUtility(ILoginTokenSet) | 2956 | logintokenset = getUtility(ILoginTokenSet) |
761 | 2958 | logintokenset.deleteByEmailRequesterAndType( | 2957 | logintokenset.deleteByEmailRequesterAndType( |
762 | 2959 | emailaddress, self.context, LoginTokenType.VALIDATEEMAIL) | 2958 | emailaddress, self.context, LoginTokenType.VALIDATEEMAIL) |
763 | @@ -3049,7 +3048,7 @@ class PersonEditMailingListsView(LaunchpadFormView): | |||
764 | 3049 | # +editmailinglists is not available on teams. | 3048 | # +editmailinglists is not available on teams. |
765 | 3050 | name = self.request['PATH_INFO'].split('/')[-1] | 3049 | name = self.request['PATH_INFO'].split('/')[-1] |
766 | 3051 | raise NotFound(self, name, request=self.request) | 3050 | raise NotFound(self, name, request=self.request) |
768 | 3052 | super(PersonEditMailingListsView, self).initialize() | 3051 | super().initialize() |
769 | 3053 | 3052 | ||
770 | 3054 | def setUpFields(self): | 3053 | def setUpFields(self): |
771 | 3055 | """Set up fields for this view. | 3054 | """Set up fields for this view. |
772 | @@ -3058,7 +3057,7 @@ class PersonEditMailingListsView(LaunchpadFormView): | |||
773 | 3058 | vocabularies for the lists of validated and unvalidated email | 3057 | vocabularies for the lists of validated and unvalidated email |
774 | 3059 | addresses. | 3058 | addresses. |
775 | 3060 | """ | 3059 | """ |
777 | 3061 | super(PersonEditMailingListsView, self).setUpFields() | 3060 | super().setUpFields() |
778 | 3062 | self.form_fields = (self._mailing_list_fields() | 3061 | self.form_fields = (self._mailing_list_fields() |
779 | 3063 | + self._autosubscribe_policy_fields()) | 3062 | + self._autosubscribe_policy_fields()) |
780 | 3064 | 3063 | ||
781 | @@ -3081,7 +3080,7 @@ class PersonEditMailingListsView(LaunchpadFormView): | |||
782 | 3081 | 3080 | ||
783 | 3082 | def setUpWidgets(self, context=None): | 3081 | def setUpWidgets(self, context=None): |
784 | 3083 | """See `LaunchpadFormView`.""" | 3082 | """See `LaunchpadFormView`.""" |
786 | 3084 | super(PersonEditMailingListsView, self).setUpWidgets(context) | 3083 | super().setUpWidgets(context) |
787 | 3085 | widget = self.widgets['mailing_list_auto_subscribe_policy'] | 3084 | widget = self.widgets['mailing_list_auto_subscribe_policy'] |
788 | 3086 | widget.display_label = False | 3085 | widget.display_label = False |
789 | 3087 | 3086 | ||
790 | @@ -3679,7 +3678,7 @@ class PersonOCIRegistryCredentialsView(LaunchpadView): | |||
791 | 3679 | def initialize(self): | 3678 | def initialize(self): |
792 | 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): |
793 | 3681 | raise Unauthorized | 3680 | raise Unauthorized |
795 | 3682 | super(PersonOCIRegistryCredentialsView, self).initialize() | 3681 | super().initialize() |
796 | 3683 | 3682 | ||
797 | 3684 | @property | 3683 | @property |
798 | 3685 | def label(self): | 3684 | def label(self): |
799 | @@ -3712,7 +3711,7 @@ class PersonEditOCIRegistryCredentialsView(LaunchpadFormView): | |||
800 | 3712 | def initialize(self): | 3711 | def initialize(self): |
801 | 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): |
802 | 3714 | raise Unauthorized | 3713 | raise Unauthorized |
804 | 3715 | super(PersonEditOCIRegistryCredentialsView, self).initialize() | 3714 | super().initialize() |
805 | 3716 | 3715 | ||
806 | 3717 | def _getFieldName(self, name, credentials_id): | 3716 | def _getFieldName(self, name, credentials_id): |
807 | 3718 | """Get the combined field name for an `OCIRegistryCredentials` ID. | 3717 | """Get the combined field name for an `OCIRegistryCredentials` ID. |
808 | @@ -3764,25 +3763,25 @@ class PersonEditOCIRegistryCredentialsView(LaunchpadFormView): | |||
809 | 3764 | 3763 | ||
810 | 3765 | def getAddFieldsRow(self): | 3764 | def getAddFieldsRow(self): |
811 | 3766 | add_url = TextLine( | 3765 | add_url = TextLine( |
813 | 3767 | __name__=u'add_url', | 3766 | __name__='add_url', |
814 | 3768 | required=False, readonly=False) | 3767 | required=False, readonly=False) |
815 | 3769 | add_region = TextLine( | 3768 | add_region = TextLine( |
817 | 3770 | __name__=u'add_region', | 3769 | __name__='add_region', |
818 | 3771 | required=False, readonly=False) | 3770 | required=False, readonly=False) |
819 | 3772 | add_owner = Choice( | 3771 | add_owner = Choice( |
821 | 3773 | __name__=u'add_owner', | 3772 | __name__='add_owner', |
822 | 3774 | vocabulary=( | 3773 | vocabulary=( |
823 | 3775 | 'AllUserTeamsParticipationPlusSelfSimpleDisplay'), | 3774 | 'AllUserTeamsParticipationPlusSelfSimpleDisplay'), |
824 | 3776 | default=self.default_owner, | 3775 | default=self.default_owner, |
825 | 3777 | required=False, readonly=False) | 3776 | required=False, readonly=False) |
826 | 3778 | add_username = TextLine( | 3777 | add_username = TextLine( |
828 | 3779 | __name__=u'add_username', | 3778 | __name__='add_username', |
829 | 3780 | required=False, readonly=False) | 3779 | required=False, readonly=False) |
830 | 3781 | add_password = Password( | 3780 | add_password = Password( |
832 | 3782 | __name__=u'add_password', | 3781 | __name__='add_password', |
833 | 3783 | required=False, readonly=False) | 3782 | required=False, readonly=False) |
834 | 3784 | add_confirm_password = Password( | 3783 | add_confirm_password = Password( |
836 | 3785 | __name__=u'add_confirm_password', | 3784 | __name__='add_confirm_password', |
837 | 3786 | required=False, readonly=False) | 3785 | required=False, readonly=False) |
838 | 3787 | 3786 | ||
839 | 3788 | return ( | 3787 | return ( |
840 | @@ -3819,8 +3818,7 @@ class PersonEditOCIRegistryCredentialsView(LaunchpadFormView): | |||
841 | 3819 | self.form_fields += FormFields(*add_fields) | 3818 | self.form_fields += FormFields(*add_fields) |
842 | 3820 | 3819 | ||
843 | 3821 | def setUpWidgets(self, context=None): | 3820 | def setUpWidgets(self, context=None): |
846 | 3822 | super(PersonEditOCIRegistryCredentialsView, self).setUpWidgets( | 3821 | super().setUpWidgets(context=context) |
845 | 3823 | context=context) | ||
847 | 3824 | for widget in self.widgets: | 3822 | for widget in self.widgets: |
848 | 3825 | widget.display_label = False | 3823 | widget.display_label = False |
849 | 3826 | widget.hint = None | 3824 | widget.hint = None |
850 | @@ -4249,19 +4247,16 @@ class ContactViaWebNotificationRecipientSet: | |||
851 | 4249 | 4247 | ||
852 | 4250 | def getEmails(self): | 4248 | def getEmails(self): |
853 | 4251 | """See `INotificationRecipientSet`.""" | 4249 | """See `INotificationRecipientSet`.""" |
856 | 4252 | for email in sorted(self._all_recipients.keys()): | 4250 | yield from sorted(self._all_recipients.keys()) |
855 | 4253 | yield email | ||
857 | 4254 | 4251 | ||
858 | 4255 | def getRecipients(self): | 4252 | def getRecipients(self): |
859 | 4256 | """See `INotificationRecipientSet`.""" | 4253 | """See `INotificationRecipientSet`.""" |
863 | 4257 | for recipient in sorted( | 4254 | yield from sorted( |
864 | 4258 | self._all_recipients.values(), key=attrgetter('displayname')): | 4255 | self._all_recipients.values(), key=attrgetter('displayname')) |
862 | 4259 | yield recipient | ||
865 | 4260 | 4256 | ||
866 | 4261 | def getRecipientPersons(self): | 4257 | def getRecipientPersons(self): |
867 | 4262 | """See `INotificationRecipientSet`.""" | 4258 | """See `INotificationRecipientSet`.""" |
870 | 4263 | for email, person in self._all_recipients.items(): | 4259 | yield from self._all_recipients.items() |
869 | 4264 | yield (email, person) | ||
871 | 4265 | 4260 | ||
872 | 4266 | def __iter__(self): | 4261 | def __iter__(self): |
873 | 4267 | """See `INotificationRecipientSet`.""" | 4262 | """See `INotificationRecipientSet`.""" |
874 | @@ -4351,7 +4346,7 @@ class EmailToPersonView(LaunchpadFormView): | |||
875 | 4351 | a vocabulary of the user's preferred (first) and validated | 4346 | a vocabulary of the user's preferred (first) and validated |
876 | 4352 | (subsequent) email addresses. | 4347 | (subsequent) email addresses. |
877 | 4353 | """ | 4348 | """ |
879 | 4354 | super(EmailToPersonView, self).setUpFields() | 4349 | super().setUpFields() |
880 | 4355 | usable_addresses = [self.user.preferredemail] | 4350 | usable_addresses = [self.user.preferredemail] |
881 | 4356 | usable_addresses.extend(self.user.validatedemails) | 4351 | usable_addresses.extend(self.user.validatedemails) |
882 | 4357 | terms = [SimpleTerm(email, email.email) for email in usable_addresses] | 4352 | terms = [SimpleTerm(email, email.email) for email in usable_addresses] |
883 | diff --git a/lib/lp/registry/browser/pillar.py b/lib/lp/registry/browser/pillar.py | |||
884 | index 4c09eb2..3f5c29d 100644 | |||
885 | --- a/lib/lp/registry/browser/pillar.py | |||
886 | +++ b/lib/lp/registry/browser/pillar.py | |||
887 | @@ -164,7 +164,7 @@ class PillarInvolvementView(LaunchpadView): | |||
888 | 164 | visible_disabled_link_names = [] | 164 | visible_disabled_link_names = [] |
889 | 165 | 165 | ||
890 | 166 | def __init__(self, context, request): | 166 | def __init__(self, context, request): |
892 | 167 | super(PillarInvolvementView, self).__init__(context, request) | 167 | super().__init__(context, request) |
893 | 168 | self.official_malone = False | 168 | self.official_malone = False |
894 | 169 | self.answers_usage = ServiceUsage.UNKNOWN | 169 | self.answers_usage = ServiceUsage.UNKNOWN |
895 | 170 | self.blueprints_usage = ServiceUsage.UNKNOWN | 170 | self.blueprints_usage = ServiceUsage.UNKNOWN |
896 | @@ -278,7 +278,7 @@ class PillarViewMixin(): | |||
897 | 278 | def initialize(self): | 278 | def initialize(self): |
898 | 279 | # Insert close team membership policy data into the json cache. | 279 | # Insert close team membership policy data into the json cache. |
899 | 280 | # This data is used for the maintainer and driver pickers. | 280 | # This data is used for the maintainer and driver pickers. |
901 | 281 | super(PillarViewMixin, self).initialize() | 281 | super().initialize() |
902 | 282 | cache = IJSONRequestCache(self.request) | 282 | cache = IJSONRequestCache(self.request) |
903 | 283 | policy_items = [(item.name, item) for item in EXCLUSIVE_TEAM_POLICY] | 283 | policy_items = [(item.name, item) for item in EXCLUSIVE_TEAM_POLICY] |
904 | 284 | team_membership_policy_data = vocabulary_to_choice_edit_items( | 284 | team_membership_policy_data = vocabulary_to_choice_edit_items( |
905 | @@ -365,7 +365,7 @@ class PillarSharingView(LaunchpadView): | |||
906 | 365 | return self._getSharingService().getPillarGrantees(self.context) | 365 | return self._getSharingService().getPillarGrantees(self.context) |
907 | 366 | 366 | ||
908 | 367 | def initialize(self): | 367 | def initialize(self): |
910 | 368 | super(PillarSharingView, self).initialize() | 368 | super().initialize() |
911 | 369 | cache = IJSONRequestCache(self.request) | 369 | cache = IJSONRequestCache(self.request) |
912 | 370 | cache.objects['information_types'] = self.information_types | 370 | cache.objects['information_types'] = self.information_types |
913 | 371 | cache.objects['sharing_permissions'] = self.sharing_permissions | 371 | cache.objects['sharing_permissions'] = self.sharing_permissions |
914 | diff --git a/lib/lp/registry/browser/poll.py b/lib/lp/registry/browser/poll.py | |||
915 | index eaba0c7..66049fe 100644 | |||
916 | --- a/lib/lp/registry/browser/poll.py | |||
917 | +++ b/lib/lp/registry/browser/poll.py | |||
918 | @@ -227,7 +227,7 @@ class PollView(BasePollView): | |||
919 | 227 | """A view class to display the results of a poll.""" | 227 | """A view class to display the results of a poll.""" |
920 | 228 | 228 | ||
921 | 229 | def initialize(self): | 229 | def initialize(self): |
923 | 230 | super(PollView, self).initialize() | 230 | super().initialize() |
924 | 231 | request = self.request | 231 | request = self.request |
925 | 232 | if (self.userCanVote() and self.context.isOpen() and | 232 | if (self.userCanVote() and self.context.isOpen() and |
926 | 233 | self.context.getActiveOptions()): | 233 | self.context.getActiveOptions()): |
927 | @@ -281,7 +281,7 @@ class PollVoteView(BasePollView): | |||
928 | 281 | 281 | ||
929 | 282 | def initialize(self): | 282 | def initialize(self): |
930 | 283 | """Process the form, if it was submitted.""" | 283 | """Process the form, if it was submitted.""" |
932 | 284 | super(PollVoteView, self).initialize() | 284 | super().initialize() |
933 | 285 | if not self.isSecret() and self.userVoted(): | 285 | if not self.isSecret() and self.userVoted(): |
934 | 286 | # For non-secret polls, the user's vote is always displayed | 286 | # For non-secret polls, the user's vote is always displayed |
935 | 287 | self.setUpTokenAndVotesForNonSecretPolls() | 287 | self.setUpTokenAndVotesForNonSecretPolls() |
936 | diff --git a/lib/lp/registry/browser/product.py b/lib/lp/registry/browser/product.py | |||
937 | index 3f58926..faea1f8 100644 | |||
938 | --- a/lib/lp/registry/browser/product.py | |||
939 | +++ b/lib/lp/registry/browser/product.py | |||
940 | @@ -517,7 +517,7 @@ class ProductEditLinksMixin(StructuralSubscriptionMenuMixin): | |||
941 | 517 | def search_oci_project(self): | 517 | def search_oci_project(self): |
942 | 518 | product = self.context.context | 518 | product = self.context.context |
943 | 519 | oci_projects = getUtility(IOCIProjectSet).findByPillarAndName( | 519 | oci_projects = getUtility(IOCIProjectSet).findByPillarAndName( |
945 | 520 | product, u'') | 520 | product, '') |
946 | 521 | text = 'Search for OCI project' | 521 | text = 'Search for OCI project' |
947 | 522 | link = Link('+search-oci-project', text, icon='info') | 522 | link = Link('+search-oci-project', text, icon='info') |
948 | 523 | link.enabled = not oci_projects.is_empty() | 523 | link.enabled = not oci_projects.is_empty() |
949 | @@ -807,7 +807,7 @@ class SeriesWithReleases(DecoratedSeries): | |||
950 | 807 | releases = None | 807 | releases = None |
951 | 808 | 808 | ||
952 | 809 | def __init__(self, series, parent): | 809 | def __init__(self, series, parent): |
954 | 810 | super(SeriesWithReleases, self).__init__(series) | 810 | super().__init__(series) |
955 | 811 | self.parent = parent | 811 | self.parent = parent |
956 | 812 | self.releases = [] | 812 | self.releases = [] |
957 | 813 | 813 | ||
958 | @@ -987,7 +987,7 @@ class ProductView(PillarViewMixin, HasAnnouncementsView, SortSeriesMixin, | |||
959 | 987 | self.form = request.form_ng | 987 | self.form = request.form_ng |
960 | 988 | 988 | ||
961 | 989 | def initialize(self): | 989 | def initialize(self): |
963 | 990 | super(ProductView, self).initialize() | 990 | super().initialize() |
964 | 991 | self.status_message = None | 991 | self.status_message = None |
965 | 992 | product = self.context | 992 | product = self.context |
966 | 993 | programming_lang = IProduct['programminglang'] | 993 | programming_lang = IProduct['programminglang'] |
967 | @@ -1370,7 +1370,7 @@ class ProductConfigureBase(ReturnToReferrerMixin, LaunchpadEditFormView): | |||
968 | 1370 | usage_fieldname = None | 1370 | usage_fieldname = None |
969 | 1371 | 1371 | ||
970 | 1372 | def setUpFields(self): | 1372 | def setUpFields(self): |
972 | 1373 | super(ProductConfigureBase, self).setUpFields() | 1373 | super().setUpFields() |
973 | 1374 | if self.usage_fieldname is not None: | 1374 | if self.usage_fieldname is not None: |
974 | 1375 | # The usage fields are shared among pillars. But when referring | 1375 | # The usage fields are shared among pillars. But when referring |
975 | 1376 | # to an individual object in Launchpad it is better to call it by | 1376 | # to an individual object in Launchpad it is better to call it by |
976 | @@ -1474,7 +1474,7 @@ class ProductEditView(ProductLicenseMixin, LaunchpadEditFormView): | |||
977 | 1474 | # when an action is invoked. | 1474 | # when an action is invoked. |
978 | 1475 | cache = IJSONRequestCache(self.request) | 1475 | cache = IJSONRequestCache(self.request) |
979 | 1476 | json_dump_information_types(cache, PILLAR_INFORMATION_TYPES) | 1476 | json_dump_information_types(cache, PILLAR_INFORMATION_TYPES) |
981 | 1477 | super(ProductEditView, self).initialize() | 1477 | super().initialize() |
982 | 1478 | 1478 | ||
983 | 1479 | def validate(self, data): | 1479 | def validate(self, data): |
984 | 1480 | """Validate 'licenses' and 'license_info'. | 1480 | """Validate 'licenses' and 'license_info'. |
985 | @@ -1485,7 +1485,7 @@ class ProductEditView(ProductLicenseMixin, LaunchpadEditFormView): | |||
986 | 1485 | 'license_info' must not be empty if "Other/Proprietary" | 1485 | 'license_info' must not be empty if "Other/Proprietary" |
987 | 1486 | or "Other/Open Source" is checked. | 1486 | or "Other/Open Source" is checked. |
988 | 1487 | """ | 1487 | """ |
990 | 1488 | super(ProductEditView, self).validate(data) | 1488 | super().validate(data) |
991 | 1489 | information_type = data.get('information_type') | 1489 | information_type = data.get('information_type') |
992 | 1490 | if information_type: | 1490 | if information_type: |
993 | 1491 | errors = [ | 1491 | errors = [ |
994 | @@ -1502,7 +1502,7 @@ class ProductEditView(ProductLicenseMixin, LaunchpadEditFormView): | |||
995 | 1502 | # LicenseWidget instead of the enclosing form. | 1502 | # LicenseWidget instead of the enclosing form. |
996 | 1503 | if field_name == 'license_info': | 1503 | if field_name == 'license_info': |
997 | 1504 | return False | 1504 | return False |
999 | 1505 | return super(ProductEditView, self).showOptionalMarker(field_name) | 1505 | return super().showOptionalMarker(field_name) |
1000 | 1506 | 1506 | ||
1001 | 1507 | @action("Change", name='change') | 1507 | @action("Change", name='change') |
1002 | 1508 | def change_action(self, action, data): | 1508 | def change_action(self, action, data): |
1003 | @@ -1550,7 +1550,7 @@ class ProductAdminView(ProductEditView, ProductValidationMixin): | |||
1004 | 1550 | if not admin: | 1550 | if not admin: |
1005 | 1551 | self.field_names.remove('owner') | 1551 | self.field_names.remove('owner') |
1006 | 1552 | self.field_names.remove('autoupdate') | 1552 | self.field_names.remove('autoupdate') |
1008 | 1553 | super(ProductAdminView, self).setUpFields() | 1553 | super().setUpFields() |
1009 | 1554 | self.form_fields = self._createAliasesField() + self.form_fields | 1554 | self.form_fields = self._createAliasesField() + self.form_fields |
1010 | 1555 | if admin: | 1555 | if admin: |
1011 | 1556 | self.form_fields = ( | 1556 | self.form_fields = ( |
1012 | @@ -1590,7 +1590,7 @@ class ProductAdminView(ProductEditView, ProductValidationMixin): | |||
1013 | 1590 | 1590 | ||
1014 | 1591 | def validate(self, data): | 1591 | def validate(self, data): |
1015 | 1592 | """See `LaunchpadFormView`.""" | 1592 | """See `LaunchpadFormView`.""" |
1017 | 1593 | super(ProductAdminView, self).validate(data) | 1593 | super().validate(data) |
1018 | 1594 | self.validate_deactivation(data) | 1594 | self.validate_deactivation(data) |
1019 | 1595 | 1595 | ||
1020 | 1596 | @property | 1596 | @property |
1021 | @@ -1618,7 +1618,7 @@ class ProductReviewLicenseView(ReturnToReferrerMixin, ProductEditView, | |||
1022 | 1618 | def validate(self, data): | 1618 | def validate(self, data): |
1023 | 1619 | """See `LaunchpadFormView`.""" | 1619 | """See `LaunchpadFormView`.""" |
1024 | 1620 | 1620 | ||
1026 | 1621 | super(ProductReviewLicenseView, self).validate(data) | 1621 | super().validate(data) |
1027 | 1622 | # A project can only be approved if it has OTHER_OPEN_SOURCE as one of | 1622 | # A project can only be approved if it has OTHER_OPEN_SOURCE as one of |
1028 | 1623 | # its licenses and not OTHER_PROPRIETARY. | 1623 | # its licenses and not OTHER_PROPRIETARY. |
1029 | 1624 | licenses = self.context.licenses | 1624 | licenses = self.context.licenses |
1030 | @@ -1848,11 +1848,11 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView, | |||
1031 | 1848 | """ | 1848 | """ |
1032 | 1849 | if self.errors_in_action: | 1849 | if self.errors_in_action: |
1033 | 1850 | return None | 1850 | return None |
1035 | 1851 | return super(ProductSetBranchView, self).next_url | 1851 | return super().next_url |
1036 | 1852 | 1852 | ||
1037 | 1853 | def setUpFields(self): | 1853 | def setUpFields(self): |
1038 | 1854 | """See `LaunchpadFormView`.""" | 1854 | """See `LaunchpadFormView`.""" |
1040 | 1855 | super(ProductSetBranchView, self).setUpFields() | 1855 | super().setUpFields() |
1041 | 1856 | if self.is_series: | 1856 | if self.is_series: |
1042 | 1857 | self.form_fields = self.form_fields.omit( | 1857 | self.form_fields = self.form_fields.omit( |
1043 | 1858 | 'default_vcs', 'git_repository_location', | 1858 | 'default_vcs', 'git_repository_location', |
1044 | @@ -1861,7 +1861,7 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView, | |||
1045 | 1861 | 1861 | ||
1046 | 1862 | def setUpWidgets(self): | 1862 | def setUpWidgets(self): |
1047 | 1863 | """See `LaunchpadFormView`.""" | 1863 | """See `LaunchpadFormView`.""" |
1049 | 1864 | super(ProductSetBranchView, self).setUpWidgets() | 1864 | super().setUpWidgets() |
1050 | 1865 | widget = self.widgets['rcs_type'] | 1865 | widget = self.widgets['rcs_type'] |
1051 | 1866 | vocab = widget.vocabulary | 1866 | vocab = widget.vocabulary |
1052 | 1867 | current_value = widget._getFormValue() | 1867 | current_value = widget._getFormValue() |
1053 | @@ -1878,9 +1878,9 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView, | |||
1054 | 1878 | widget = self.widgets['branch_type'] | 1878 | widget = self.widgets['branch_type'] |
1055 | 1879 | current_value = widget._getFormValue() | 1879 | current_value = widget._getFormValue() |
1056 | 1880 | vocab = widget.vocabulary | 1880 | vocab = widget.vocabulary |
1058 | 1881 | self.branch_type_link, self.branch_type_import = [ | 1881 | self.branch_type_link, self.branch_type_import = ( |
1059 | 1882 | render_radio_widget_part(widget, value, current_value) | 1882 | render_radio_widget_part(widget, value, current_value) |
1061 | 1883 | for value in (LINK_LP, IMPORT_EXTERNAL)] | 1883 | for value in (LINK_LP, IMPORT_EXTERNAL)) |
1062 | 1884 | 1884 | ||
1063 | 1885 | if not self.is_series: | 1885 | if not self.is_series: |
1064 | 1886 | widget = self.widgets['default_vcs'] | 1886 | widget = self.widgets['default_vcs'] |
1065 | @@ -1894,9 +1894,9 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView, | |||
1066 | 1894 | widget = self.widgets['git_repository_type'] | 1894 | widget = self.widgets['git_repository_type'] |
1067 | 1895 | current_value = widget._getFormValue() | 1895 | current_value = widget._getFormValue() |
1068 | 1896 | vocab = widget.vocabulary | 1896 | vocab = widget.vocabulary |
1070 | 1897 | self.git_repository_type_link, self.git_repository_type_import = [ | 1897 | self.git_repository_type_link, self.git_repository_type_import = ( |
1071 | 1898 | render_radio_widget_part(widget, value, current_value) | 1898 | render_radio_widget_part(widget, value, current_value) |
1073 | 1899 | for value in (LINK_LP, IMPORT_EXTERNAL)] | 1899 | for value in (LINK_LP, IMPORT_EXTERNAL)) |
1074 | 1900 | 1900 | ||
1075 | 1901 | def _validateLinkLpBzr(self, data): | 1901 | def _validateLinkLpBzr(self, data): |
1076 | 1902 | """Validate data for link-lp bzr case.""" | 1902 | """Validate data for link-lp bzr case.""" |
1077 | @@ -2005,7 +2005,7 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView, | |||
1078 | 2005 | """See `LaunchpadFormView`.""" | 2005 | """See `LaunchpadFormView`.""" |
1079 | 2006 | names = [ | 2006 | names = [ |
1080 | 2007 | 'branch_type', 'rcs_type', 'default_vcs', 'git_repository_type'] | 2007 | 'branch_type', 'rcs_type', 'default_vcs', 'git_repository_type'] |
1082 | 2008 | super(ProductSetBranchView, self).validate_widgets(data, names) | 2008 | super().validate_widgets(data, names) |
1083 | 2009 | 2009 | ||
1084 | 2010 | if not self.is_series: | 2010 | if not self.is_series: |
1085 | 2011 | git_repository_type = data.get('git_repository_type') | 2011 | git_repository_type = data.get('git_repository_type') |
1086 | @@ -2040,7 +2040,7 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView, | |||
1087 | 2040 | raise AssertionError("Unknown branch type %s" % branch_type) | 2040 | raise AssertionError("Unknown branch type %s" % branch_type) |
1088 | 2041 | 2041 | ||
1089 | 2042 | # Perform full validation now. | 2042 | # Perform full validation now. |
1091 | 2043 | super(ProductSetBranchView, self).validate_widgets(data) | 2043 | super().validate_widgets(data) |
1092 | 2044 | 2044 | ||
1093 | 2045 | def validate(self, data): | 2045 | def validate(self, data): |
1094 | 2046 | """See `LaunchpadFormView`.""" | 2046 | """See `LaunchpadFormView`.""" |
1095 | @@ -2345,12 +2345,12 @@ class ProjectAddStepOne(StepView): | |||
1096 | 2345 | 2345 | ||
1097 | 2346 | def setUpFields(self): | 2346 | def setUpFields(self): |
1098 | 2347 | """See `LaunchpadFormView`.""" | 2347 | """See `LaunchpadFormView`.""" |
1100 | 2348 | super(ProjectAddStepOne, self).setUpFields() | 2348 | super().setUpFields() |
1101 | 2349 | self.form_fields = (self.form_fields + create_source_package_fields()) | 2349 | self.form_fields = (self.form_fields + create_source_package_fields()) |
1102 | 2350 | 2350 | ||
1103 | 2351 | def setUpWidgets(self): | 2351 | def setUpWidgets(self): |
1104 | 2352 | """See `LaunchpadFormView`.""" | 2352 | """See `LaunchpadFormView`.""" |
1106 | 2353 | super(ProjectAddStepOne, self).setUpWidgets() | 2353 | super().setUpWidgets() |
1107 | 2354 | self.widgets['source_package_name'].visible = False | 2354 | self.widgets['source_package_name'].visible = False |
1108 | 2355 | self.widgets['distroseries'].visible = False | 2355 | self.widgets['distroseries'].visible = False |
1109 | 2356 | 2356 | ||
1110 | @@ -2425,14 +2425,14 @@ class ProjectAddStepTwo(StepView, ProductLicenseMixin, ReturnToReferrerMixin): | |||
1111 | 2425 | # when an action is invoked. | 2425 | # when an action is invoked. |
1112 | 2426 | cache = IJSONRequestCache(self.request) | 2426 | cache = IJSONRequestCache(self.request) |
1113 | 2427 | json_dump_information_types(cache, PILLAR_INFORMATION_TYPES) | 2427 | json_dump_information_types(cache, PILLAR_INFORMATION_TYPES) |
1115 | 2428 | super(ProjectAddStepTwo, self).initialize() | 2428 | super().initialize() |
1116 | 2429 | 2429 | ||
1117 | 2430 | @property | 2430 | @property |
1118 | 2431 | def main_action_label(self): | 2431 | def main_action_label(self): |
1119 | 2432 | if self.source_package_name is None: | 2432 | if self.source_package_name is None: |
1121 | 2433 | return u'Complete Registration' | 2433 | return 'Complete Registration' |
1122 | 2434 | else: | 2434 | else: |
1124 | 2435 | return u'Complete registration and link to %s package' % ( | 2435 | return 'Complete registration and link to %s package' % ( |
1125 | 2436 | self.source_package_name.name) | 2436 | self.source_package_name.name) |
1126 | 2437 | 2437 | ||
1127 | 2438 | @property | 2438 | @property |
1128 | @@ -2467,7 +2467,7 @@ class ProjectAddStepTwo(StepView, ProductLicenseMixin, ReturnToReferrerMixin): | |||
1129 | 2467 | 2467 | ||
1130 | 2468 | def setUpFields(self): | 2468 | def setUpFields(self): |
1131 | 2469 | """See `LaunchpadFormView`.""" | 2469 | """See `LaunchpadFormView`.""" |
1133 | 2470 | super(ProjectAddStepTwo, self).setUpFields() | 2470 | super().setUpFields() |
1134 | 2471 | hidden_names = ['__visited_steps__', 'license_info'] | 2471 | hidden_names = ['__visited_steps__', 'license_info'] |
1135 | 2472 | hidden_fields = self.form_fields.select(*hidden_names) | 2472 | hidden_fields = self.form_fields.select(*hidden_names) |
1136 | 2473 | 2473 | ||
1137 | @@ -2502,7 +2502,7 @@ class ProjectAddStepTwo(StepView, ProductLicenseMixin, ReturnToReferrerMixin): | |||
1138 | 2502 | 2502 | ||
1139 | 2503 | def setUpWidgets(self): | 2503 | def setUpWidgets(self): |
1140 | 2504 | """See `LaunchpadFormView`.""" | 2504 | """See `LaunchpadFormView`.""" |
1142 | 2505 | super(ProjectAddStepTwo, self).setUpWidgets() | 2505 | super().setUpWidgets() |
1143 | 2506 | self.widgets['name'].read_only = True | 2506 | self.widgets['name'].read_only = True |
1144 | 2507 | # The "hint" is really more of an explanation at this point, but the | 2507 | # The "hint" is really more of an explanation at this point, but the |
1145 | 2508 | # phrasing is different. | 2508 | # phrasing is different. |
1146 | diff --git a/lib/lp/registry/browser/productrelease.py b/lib/lp/registry/browser/productrelease.py | |||
1147 | index 9bb9242..ac680b8 100644 | |||
1148 | --- a/lib/lp/registry/browser/productrelease.py | |||
1149 | +++ b/lib/lp/registry/browser/productrelease.py | |||
1150 | @@ -167,10 +167,10 @@ class ProductReleaseAddView(ProductReleaseAddViewBase): | |||
1151 | 167 | self.request.response.redirect( | 167 | self.request.response.redirect( |
1152 | 168 | canonical_url(self.context.product_release) + '/+edit') | 168 | canonical_url(self.context.product_release) + '/+edit') |
1153 | 169 | else: | 169 | else: |
1155 | 170 | super(ProductReleaseAddView, self).initialize() | 170 | super().initialize() |
1156 | 171 | 171 | ||
1157 | 172 | def setUpFields(self): | 172 | def setUpFields(self): |
1159 | 173 | super(ProductReleaseAddView, self).setUpFields() | 173 | super().setUpFields() |
1160 | 174 | if self.context.active is True: | 174 | if self.context.active is True: |
1161 | 175 | self._prependKeepMilestoneActiveField() | 175 | self._prependKeepMilestoneActiveField() |
1162 | 176 | 176 | ||
1163 | @@ -193,7 +193,7 @@ class ProductReleaseFromSeriesAddView(ProductReleaseAddViewBase, | |||
1164 | 193 | ] | 193 | ] |
1165 | 194 | 194 | ||
1166 | 195 | def setUpFields(self): | 195 | def setUpFields(self): |
1168 | 196 | super(ProductReleaseFromSeriesAddView, self).setUpFields() | 196 | super().setUpFields() |
1169 | 197 | self._prependKeepMilestoneActiveField() | 197 | self._prependKeepMilestoneActiveField() |
1170 | 198 | self._prependMilestoneField() | 198 | self._prependMilestoneField() |
1171 | 199 | 199 | ||
1172 | @@ -288,7 +288,7 @@ class ProductReleaseAddDownloadFileView(LaunchpadFormView): | |||
1173 | 288 | if file_name and self.context.hasReleaseFile(file_name): | 288 | if file_name and self.context.hasReleaseFile(file_name): |
1174 | 289 | self.setFieldError( | 289 | self.setFieldError( |
1175 | 290 | 'filecontent', | 290 | 'filecontent', |
1177 | 291 | u"The file '%s' is already uploaded." % file_name) | 291 | "The file '%s' is already uploaded." % file_name) |
1178 | 292 | 292 | ||
1179 | 293 | @action('Upload', name='add') | 293 | @action('Upload', name='add') |
1180 | 294 | def add_action(self, action, data): | 294 | def add_action(self, action, data): |
1181 | diff --git a/lib/lp/registry/browser/productseries.py b/lib/lp/registry/browser/productseries.py | |||
1182 | index 8af4afb..707b077 100644 | |||
1183 | --- a/lib/lp/registry/browser/productseries.py | |||
1184 | +++ b/lib/lp/registry/browser/productseries.py | |||
1185 | @@ -197,7 +197,7 @@ class ProductSeriesInvolvementView(PillarInvolvementView): | |||
1186 | 197 | has_involvement = True | 197 | has_involvement = True |
1187 | 198 | 198 | ||
1188 | 199 | def __init__(self, context, request): | 199 | def __init__(self, context, request): |
1190 | 200 | super(ProductSeriesInvolvementView, self).__init__(context, request) | 200 | super().__init__(context, request) |
1191 | 201 | self.answers_usage = ServiceUsage.NOT_APPLICABLE | 201 | self.answers_usage = ServiceUsage.NOT_APPLICABLE |
1192 | 202 | if self.context.branch is not None: | 202 | if self.context.branch is not None: |
1193 | 203 | self.codehosting_usage = ServiceUsage.LAUNCHPAD | 203 | self.codehosting_usage = ServiceUsage.LAUNCHPAD |
1194 | @@ -370,7 +370,7 @@ class ProductSeriesView( | |||
1195 | 370 | """A view to show a series with translations.""" | 370 | """A view to show a series with translations.""" |
1196 | 371 | 371 | ||
1197 | 372 | def initialize(self): | 372 | def initialize(self): |
1199 | 373 | super(ProductSeriesView, self).initialize() | 373 | super().initialize() |
1200 | 374 | expose_structural_subscription_data_to_js( | 374 | expose_structural_subscription_data_to_js( |
1201 | 375 | self.context, self.request, self.user) | 375 | self.context, self.request, self.user) |
1202 | 376 | 376 | ||
1203 | @@ -506,8 +506,7 @@ class ProductSeriesUbuntuPackagingView(LaunchpadFormView): | |||
1204 | 506 | 506 | ||
1205 | 507 | def __init__(self, context, request): | 507 | def __init__(self, context, request): |
1206 | 508 | """Set the static packaging information for this series.""" | 508 | """Set the static packaging information for this series.""" |
1209 | 509 | super(ProductSeriesUbuntuPackagingView, self).__init__( | 509 | super().__init__(context, request) |
1208 | 510 | context, request) | ||
1210 | 511 | self._ubuntu = getUtility(ILaunchpadCelebrities).ubuntu | 510 | self._ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
1211 | 512 | self._ubuntu_series = self._ubuntu.currentseries | 511 | self._ubuntu_series = self._ubuntu.currentseries |
1212 | 513 | try: | 512 | try: |
1213 | @@ -534,7 +533,7 @@ class ProductSeriesUbuntuPackagingView(LaunchpadFormView): | |||
1214 | 534 | The packaging is restricted to ubuntu series and the default value | 533 | The packaging is restricted to ubuntu series and the default value |
1215 | 535 | is the current development series. | 534 | is the current development series. |
1216 | 536 | """ | 535 | """ |
1218 | 537 | super(ProductSeriesUbuntuPackagingView, self).setUpFields() | 536 | super().setUpFields() |
1219 | 538 | series_vocabulary = SimpleVocabulary( | 537 | series_vocabulary = SimpleVocabulary( |
1220 | 539 | [SimpleTerm(series, series.name, series.named_version) | 538 | [SimpleTerm(series, series.name, series.named_version) |
1221 | 540 | for series in self._ubuntu.series]) | 539 | for series in self._ubuntu.series]) |
1222 | diff --git a/lib/lp/registry/browser/project.py b/lib/lp/registry/browser/project.py | |||
1223 | index 3927fc6..2a7ee6a 100644 | |||
1224 | --- a/lib/lp/registry/browser/project.py | |||
1225 | +++ b/lib/lp/registry/browser/project.py | |||
1226 | @@ -136,7 +136,7 @@ class ProjectNavigation(Navigation, | |||
1227 | 136 | 136 | ||
1228 | 137 | @stepthrough('+tags') | 137 | @stepthrough('+tags') |
1229 | 138 | def traverse_tags(self, name): | 138 | def traverse_tags(self, name): |
1231 | 139 | tags = name.split(u',') | 139 | tags = name.split(',') |
1232 | 140 | if validate_tags(tags): | 140 | if validate_tags(tags): |
1233 | 141 | return ProjectGroupMilestoneTag(self.context, tags) | 141 | return ProjectGroupMilestoneTag(self.context, tags) |
1234 | 142 | 142 | ||
1235 | @@ -354,7 +354,7 @@ class ProjectView(PillarViewMixin, HasAnnouncementsView, FeedsMixin): | |||
1236 | 354 | help_link="/+help-registry/driver.html", show_create_team=True) | 354 | help_link="/+help-registry/driver.html", show_create_team=True) |
1237 | 355 | 355 | ||
1238 | 356 | def initialize(self): | 356 | def initialize(self): |
1240 | 357 | super(ProjectView, self).initialize() | 357 | super().initialize() |
1241 | 358 | expose_structural_subscription_data_to_js( | 358 | expose_structural_subscription_data_to_js( |
1242 | 359 | self.context, self.request, self.user) | 359 | self.context, self.request, self.user) |
1243 | 360 | 360 | ||
1244 | @@ -422,7 +422,7 @@ class ProjectReviewView(ProjectEditView): | |||
1245 | 422 | moderator = check_permission('launchpad.Moderate', self.context) | 422 | moderator = check_permission('launchpad.Moderate', self.context) |
1246 | 423 | if not moderator: | 423 | if not moderator: |
1247 | 424 | self.field_names.remove('name') | 424 | self.field_names.remove('name') |
1249 | 425 | super(ProjectReviewView, self).setUpFields() | 425 | super().setUpFields() |
1250 | 426 | self.form_fields = self._createAliasesField() + self.form_fields | 426 | self.form_fields = self._createAliasesField() + self.form_fields |
1251 | 427 | if admin: | 427 | if admin: |
1252 | 428 | self.form_fields = ( | 428 | self.form_fields = ( |
1253 | @@ -544,7 +544,7 @@ class ProjectSetView(LaunchpadView): | |||
1254 | 544 | page_title = "Project groups registered in Launchpad" | 544 | page_title = "Project groups registered in Launchpad" |
1255 | 545 | 545 | ||
1256 | 546 | def __init__(self, context, request): | 546 | def __init__(self, context, request): |
1258 | 547 | super(ProjectSetView, self).__init__(context, request) | 547 | super().__init__(context, request) |
1259 | 548 | self.form = self.request.form_ng | 548 | self.form = self.request.form_ng |
1260 | 549 | self.search_string = self.form.getOne('text', None) | 549 | self.search_string = self.form.getOne('text', None) |
1261 | 550 | self.search_requested = False | 550 | self.search_requested = False |
1262 | diff --git a/lib/lp/registry/browser/sourcepackage.py b/lib/lp/registry/browser/sourcepackage.py | |||
1263 | index ea447c2..43e6fb7 100644 | |||
1264 | --- a/lib/lp/registry/browser/sourcepackage.py | |||
1265 | +++ b/lib/lp/registry/browser/sourcepackage.py | |||
1266 | @@ -265,7 +265,7 @@ class SourcePackageChangeUpstreamStepOne(ReturnToReferrerMixin, StepView): | |||
1267 | 265 | product = None | 265 | product = None |
1268 | 266 | 266 | ||
1269 | 267 | def setUpFields(self): | 267 | def setUpFields(self): |
1271 | 268 | super(SourcePackageChangeUpstreamStepOne, self).setUpFields() | 268 | super().setUpFields() |
1272 | 269 | series = self.context.productseries | 269 | series = self.context.productseries |
1273 | 270 | if series is not None: | 270 | if series is not None: |
1274 | 271 | default = series.product | 271 | default = series.product |
1275 | @@ -284,7 +284,7 @@ class SourcePackageChangeUpstreamStepOne(ReturnToReferrerMixin, StepView): | |||
1276 | 284 | self.request.form['product'] = data['product'] | 284 | self.request.form['product'] = data['product'] |
1277 | 285 | 285 | ||
1278 | 286 | def validateStep(self, data): | 286 | def validateStep(self, data): |
1280 | 287 | super(SourcePackageChangeUpstreamStepOne, self).validateStep(data) | 287 | super().validateStep(data) |
1281 | 288 | product = data.get('product') | 288 | product = data.get('product') |
1282 | 289 | if product is None: | 289 | if product is None: |
1283 | 290 | return | 290 | return |
1284 | @@ -318,7 +318,7 @@ class SourcePackageChangeUpstreamStepTwo(ReturnToReferrerMixin, StepView): | |||
1285 | 318 | custom_widget_productseries = LaunchpadRadioWidget | 318 | custom_widget_productseries = LaunchpadRadioWidget |
1286 | 319 | 319 | ||
1287 | 320 | def setUpFields(self): | 320 | def setUpFields(self): |
1289 | 321 | super(SourcePackageChangeUpstreamStepTwo, self).setUpFields() | 321 | super().setUpFields() |
1290 | 322 | 322 | ||
1291 | 323 | # The vocabulary for the product series is overridden to just | 323 | # The vocabulary for the product series is overridden to just |
1292 | 324 | # include active series from the product selected in the | 324 | # include active series from the product selected in the |
1293 | @@ -380,7 +380,7 @@ class SourcePackageChangeUpstreamStepTwo(ReturnToReferrerMixin, StepView): | |||
1294 | 380 | # is called. | 380 | # is called. |
1295 | 381 | next_url = None | 381 | next_url = None |
1296 | 382 | 382 | ||
1298 | 383 | main_action_label = u'Change' | 383 | main_action_label = 'Change' |
1299 | 384 | 384 | ||
1300 | 385 | def main_action(self, data): | 385 | def main_action(self, data): |
1301 | 386 | productseries = data['productseries'] | 386 | productseries = data['productseries'] |
1302 | @@ -564,7 +564,7 @@ class SourcePackageAssociationPortletView(LaunchpadFormView): | |||
1303 | 564 | 564 | ||
1304 | 565 | def setUpFields(self): | 565 | def setUpFields(self): |
1305 | 566 | """See `LaunchpadFormView`.""" | 566 | """See `LaunchpadFormView`.""" |
1307 | 567 | super(SourcePackageAssociationPortletView, self).setUpFields() | 567 | super().setUpFields() |
1308 | 568 | self.request.annotations['show_edit_buttons'] = True | 568 | self.request.annotations['show_edit_buttons'] = True |
1309 | 569 | # Find registered products that are similarly named to the source | 569 | # Find registered products that are similarly named to the source |
1310 | 570 | # package. | 570 | # package. |
1311 | diff --git a/lib/lp/registry/browser/team.py b/lib/lp/registry/browser/team.py | |||
1312 | index eeefcee..c37bbf0 100644 | |||
1313 | --- a/lib/lp/registry/browser/team.py | |||
1314 | +++ b/lib/lp/registry/browser/team.py | |||
1315 | @@ -42,7 +42,6 @@ from lazr.restful.interfaces import IJSONRequestCache | |||
1316 | 42 | from lazr.restful.utils import smartquote | 42 | from lazr.restful.utils import smartquote |
1317 | 43 | import pytz | 43 | import pytz |
1318 | 44 | import simplejson | 44 | import simplejson |
1319 | 45 | import six | ||
1320 | 46 | from six.moves.urllib.parse import unquote | 45 | from six.moves.urllib.parse import unquote |
1321 | 47 | from zope.browserpage import ViewPageTemplateFile | 46 | from zope.browserpage import ViewPageTemplateFile |
1322 | 48 | from zope.component import getUtility | 47 | from zope.component import getUtility |
1323 | @@ -219,14 +218,12 @@ class HasRenewalPolicyMixin: | |||
1324 | 219 | def isMultiLineLayout(self, field_name): | 218 | def isMultiLineLayout(self, field_name): |
1325 | 220 | if field_name == 'renewal_policy': | 219 | if field_name == 'renewal_policy': |
1326 | 221 | return True | 220 | return True |
1329 | 222 | return super(HasRenewalPolicyMixin, self).isMultiLineLayout( | 221 | return super().isMultiLineLayout(field_name) |
1328 | 223 | field_name) | ||
1330 | 224 | 222 | ||
1331 | 225 | def isSingleLineLayout(self, field_name): | 223 | def isSingleLineLayout(self, field_name): |
1332 | 226 | if field_name == 'renewal_policy': | 224 | if field_name == 'renewal_policy': |
1333 | 227 | return False | 225 | return False |
1336 | 228 | return super(HasRenewalPolicyMixin, self).isSingleLineLayout( | 226 | return super().isSingleLineLayout(field_name) |
1335 | 229 | field_name) | ||
1337 | 230 | 227 | ||
1338 | 231 | 228 | ||
1339 | 232 | class TeamFormMixin: | 229 | class TeamFormMixin: |
1340 | @@ -317,11 +314,11 @@ class TeamEditView(TeamFormMixin, PersonRenameFormMixin, | |||
1341 | 317 | # class list. | 314 | # class list. |
1342 | 318 | self.field_names = list(self.field_names) | 315 | self.field_names = list(self.field_names) |
1343 | 319 | self.field_names.remove('teamowner') | 316 | self.field_names.remove('teamowner') |
1345 | 320 | super(TeamEditView, self).setUpFields() | 317 | super().setUpFields() |
1346 | 321 | self.setUpVisibilityField(render_context=True) | 318 | self.setUpVisibilityField(render_context=True) |
1347 | 322 | 319 | ||
1348 | 323 | def setUpWidgets(self): | 320 | def setUpWidgets(self): |
1350 | 324 | super(TeamEditView, self).setUpWidgets() | 321 | super().setUpWidgets() |
1351 | 325 | team = self.context | 322 | team = self.context |
1352 | 326 | # Do we need to only show open membership policy choices? | 323 | # Do we need to only show open membership policy choices? |
1353 | 327 | try: | 324 | try: |
1354 | @@ -457,7 +454,7 @@ class TeamContactAddressView(MailingListTeamBaseView): | |||
1355 | 457 | def setUpFields(self): | 454 | def setUpFields(self): |
1356 | 458 | """See `LaunchpadFormView`. | 455 | """See `LaunchpadFormView`. |
1357 | 459 | """ | 456 | """ |
1359 | 460 | super(TeamContactAddressView, self).setUpFields() | 457 | super().setUpFields() |
1360 | 461 | 458 | ||
1361 | 462 | # Replace the default contact_method field by a custom one. | 459 | # Replace the default contact_method field by a custom one. |
1362 | 463 | self.form_fields = ( | 460 | self.form_fields = ( |
1363 | @@ -525,7 +522,7 @@ class TeamContactAddressView(MailingListTeamBaseView): | |||
1364 | 525 | # responsibility for security on the exception thrower. | 522 | # responsibility for security on the exception thrower. |
1365 | 526 | msg = error.args[0] | 523 | msg = error.args[0] |
1366 | 527 | if not IStructuredString.providedBy(msg): | 524 | if not IStructuredString.providedBy(msg): |
1368 | 528 | msg = structured(six.text_type(msg)) | 525 | msg = structured(str(msg)) |
1369 | 529 | self.setFieldError('contact_address', msg) | 526 | self.setFieldError('contact_address', msg) |
1370 | 530 | elif data['contact_method'] == TeamContactMethod.HOSTED_LIST: | 527 | elif data['contact_method'] == TeamContactMethod.HOSTED_LIST: |
1371 | 531 | mailing_list = getUtility(IMailingListSet).get(self.context.name) | 528 | mailing_list = getUtility(IMailingListSet).get(self.context.name) |
1372 | @@ -621,8 +618,7 @@ class TeamMailingListConfigurationView(MailingListTeamBaseView): | |||
1373 | 621 | address. Second, the mailing list may be in a transitional | 618 | address. Second, the mailing list may be in a transitional |
1374 | 622 | state: from MODIFIED to UPDATING to ACTIVE can take a while. | 619 | state: from MODIFIED to UPDATING to ACTIVE can take a while. |
1375 | 623 | """ | 620 | """ |
1378 | 624 | super(TeamMailingListConfigurationView, self).__init__( | 621 | super().__init__(context, request) |
1377 | 625 | context, request) | ||
1379 | 626 | list_set = getUtility(IMailingListSet) | 622 | list_set = getUtility(IMailingListSet) |
1380 | 627 | self.mailing_list = list_set.get(self.context.name) | 623 | self.mailing_list = list_set.get(self.context.name) |
1381 | 628 | 624 | ||
1382 | @@ -903,7 +899,7 @@ class TeamMailingListModerationView(MailingListTeamBaseView): | |||
1383 | 903 | 899 | ||
1384 | 904 | def __init__(self, context, request): | 900 | def __init__(self, context, request): |
1385 | 905 | """Allow for review and moderation of held mailing list posts.""" | 901 | """Allow for review and moderation of held mailing list posts.""" |
1387 | 906 | super(TeamMailingListModerationView, self).__init__(context, request) | 902 | super().__init__(context, request) |
1388 | 907 | list_set = getUtility(IMailingListSet) | 903 | list_set = getUtility(IMailingListSet) |
1389 | 908 | self.mailing_list = list_set.get(self.context.name) | 904 | self.mailing_list = list_set.get(self.context.name) |
1390 | 909 | if self.mailing_list is None: | 905 | if self.mailing_list is None: |
1391 | @@ -988,7 +984,7 @@ class TeamMailingListArchiveView(LaunchpadView): | |||
1392 | 988 | label = "Mailing list archive" | 984 | label = "Mailing list archive" |
1393 | 989 | 985 | ||
1394 | 990 | def __init__(self, context, request): | 986 | def __init__(self, context, request): |
1396 | 991 | super(TeamMailingListArchiveView, self).__init__(context, request) | 987 | super().__init__(context, request) |
1397 | 992 | self.messages = self._get_messages() | 988 | self.messages = self._get_messages() |
1398 | 993 | cache = IJSONRequestCache(request).objects | 989 | cache = IJSONRequestCache(request).objects |
1399 | 994 | cache['mail'] = self.messages | 990 | cache['mail'] = self.messages |
1400 | @@ -1021,7 +1017,7 @@ class TeamAddView(TeamFormMixin, HasRenewalPolicyMixin, LaunchpadFormView): | |||
1401 | 1021 | 1017 | ||
1402 | 1022 | Only Launchpad Admins get to see the visibility field. | 1018 | Only Launchpad Admins get to see the visibility field. |
1403 | 1023 | """ | 1019 | """ |
1405 | 1024 | super(TeamAddView, self).setUpFields() | 1020 | super().setUpFields() |
1406 | 1025 | self.setUpVisibilityField() | 1021 | self.setUpVisibilityField() |
1407 | 1026 | 1022 | ||
1408 | 1027 | @action('Create Team', name='create', | 1023 | @action('Create Team', name='create', |
1409 | @@ -1201,7 +1197,7 @@ class TeamMemberAddView(LaunchpadFormView): | |||
1410 | 1201 | if error: | 1197 | if error: |
1411 | 1202 | self.setFieldError("newmember", error) | 1198 | self.setFieldError("newmember", error) |
1412 | 1203 | 1199 | ||
1414 | 1204 | @action(u"Add Member", name="add") | 1200 | @action("Add Member", name="add") |
1415 | 1205 | def add_action(self, action, data): | 1201 | def add_action(self, action, data): |
1416 | 1206 | """Add the new member to the team.""" | 1202 | """Add the new member to the team.""" |
1417 | 1207 | newmember = data['newmember'] | 1203 | newmember = data['newmember'] |
1418 | @@ -1778,7 +1774,7 @@ class TeamJoinView(LaunchpadFormView, TeamJoinMixin): | |||
1419 | 1778 | page_title = label | 1774 | page_title = label |
1420 | 1779 | 1775 | ||
1421 | 1780 | def setUpWidgets(self): | 1776 | def setUpWidgets(self): |
1423 | 1781 | super(TeamJoinView, self).setUpWidgets() | 1777 | super().setUpWidgets() |
1424 | 1782 | if 'mailinglist_subscribe' in self.field_names: | 1778 | if 'mailinglist_subscribe' in self.field_names: |
1425 | 1783 | widget = self.widgets['mailinglist_subscribe'] | 1779 | widget = self.widgets['mailinglist_subscribe'] |
1426 | 1784 | widget.setRenderedValue(self.user_wants_list_subscriptions) | 1780 | widget.setRenderedValue(self.user_wants_list_subscriptions) |
1427 | @@ -1914,7 +1910,7 @@ class TeamAddMyTeamsView(LaunchpadFormView): | |||
1428 | 1914 | else: | 1910 | else: |
1429 | 1915 | self.label = 'Add these teams to %s' % context.displayname | 1911 | self.label = 'Add these teams to %s' % context.displayname |
1430 | 1916 | self.next_url = canonical_url(context) | 1912 | self.next_url = canonical_url(context) |
1432 | 1917 | super(TeamAddMyTeamsView, self).initialize() | 1913 | super().initialize() |
1433 | 1918 | 1914 | ||
1434 | 1919 | def setUpFields(self): | 1915 | def setUpFields(self): |
1435 | 1920 | terms = [] | 1916 | terms = [] |
1436 | @@ -1930,7 +1926,7 @@ class TeamAddMyTeamsView(LaunchpadFormView): | |||
1437 | 1930 | render_context=self.render_context) | 1926 | render_context=self.render_context) |
1438 | 1931 | 1927 | ||
1439 | 1932 | def setUpWidgets(self, context=None): | 1928 | def setUpWidgets(self, context=None): |
1441 | 1933 | super(TeamAddMyTeamsView, self).setUpWidgets(context) | 1929 | super().setUpWidgets(context) |
1442 | 1934 | self.widgets['teams'].display_label = False | 1930 | self.widgets['teams'].display_label = False |
1443 | 1935 | 1931 | ||
1444 | 1936 | @cachedproperty | 1932 | @cachedproperty |
1445 | @@ -2063,7 +2059,7 @@ class TeamReassignmentView(ObjectReassignmentView): | |||
1446 | 2063 | schema = ITeamReassignment | 2059 | schema = ITeamReassignment |
1447 | 2064 | 2060 | ||
1448 | 2065 | def __init__(self, context, request): | 2061 | def __init__(self, context, request): |
1450 | 2066 | super(TeamReassignmentView, self).__init__(context, request) | 2062 | super().__init__(context, request) |
1451 | 2067 | self.callback = self._afterOwnerChange | 2063 | self.callback = self._afterOwnerChange |
1452 | 2068 | self.teamdisplayname = self.contextName | 2064 | self.teamdisplayname = self.contextName |
1453 | 2069 | self._next_url = canonical_url(self.context) | 2065 | self._next_url = canonical_url(self.context) |
1454 | diff --git a/lib/lp/registry/browser/teammembership.py b/lib/lp/registry/browser/teammembership.py | |||
1455 | index ef62f97..3610e3e 100644 | |||
1456 | --- a/lib/lp/registry/browser/teammembership.py | |||
1457 | +++ b/lib/lp/registry/browser/teammembership.py | |||
1458 | @@ -38,7 +38,7 @@ class TeamMembershipBreadcrumb(Breadcrumb): | |||
1459 | 38 | class TeamMembershipEditView(LaunchpadView): | 38 | class TeamMembershipEditView(LaunchpadView): |
1460 | 39 | 39 | ||
1461 | 40 | def __init__(self, context, request): | 40 | def __init__(self, context, request): |
1463 | 41 | super(TeamMembershipEditView, self).__init__(context, request) | 41 | super().__init__(context, request) |
1464 | 42 | self.errormessage = "" | 42 | self.errormessage = "" |
1465 | 43 | self.prefix = 'membership' | 43 | self.prefix = 'membership' |
1466 | 44 | self.max_year = 2050 | 44 | self.max_year = 2050 |
1467 | diff --git a/lib/lp/registry/browser/tests/test_announcements.py b/lib/lp/registry/browser/tests/test_announcements.py | |||
1468 | index b79d42e..5f005c6 100644 | |||
1469 | --- a/lib/lp/registry/browser/tests/test_announcements.py | |||
1470 | +++ b/lib/lp/registry/browser/tests/test_announcements.py | |||
1471 | @@ -30,8 +30,8 @@ class TestAnnouncement(TestCaseWithFactory): | |||
1472 | 30 | layer = LaunchpadFunctionalLayer | 30 | layer = LaunchpadFunctionalLayer |
1473 | 31 | 31 | ||
1474 | 32 | def test_announcement_info(self): | 32 | def test_announcement_info(self): |
1477 | 33 | product = self.factory.makeProduct(displayname=u"Foo") | 33 | product = self.factory.makeProduct(displayname="Foo") |
1478 | 34 | announcer = self.factory.makePerson(displayname=u"Bar Baz") | 34 | announcer = self.factory.makePerson(displayname="Bar Baz") |
1479 | 35 | announcement = product.announce(announcer, "Hello World") | 35 | announcement = product.announce(announcer, "Hello World") |
1480 | 36 | view = create_initialized_view(announcement, "+index") | 36 | view = create_initialized_view(announcement, "+index") |
1481 | 37 | root = html.fromstring(view()) | 37 | root = html.fromstring(view()) |
1482 | @@ -41,8 +41,8 @@ class TestAnnouncement(TestCaseWithFactory): | |||
1483 | 41 | normalize_whitespace(reg_para.text_content())) | 41 | normalize_whitespace(reg_para.text_content())) |
1484 | 42 | 42 | ||
1485 | 43 | def test_announcement_info_with_publication_date(self): | 43 | def test_announcement_info_with_publication_date(self): |
1488 | 44 | product = self.factory.makeProduct(displayname=u"Foo") | 44 | product = self.factory.makeProduct(displayname="Foo") |
1489 | 45 | announcer = self.factory.makePerson(displayname=u"Bar Baz") | 45 | announcer = self.factory.makePerson(displayname="Bar Baz") |
1490 | 46 | announced = datetime(2007, 1, 12, tzinfo=utc) | 46 | announced = datetime(2007, 1, 12, tzinfo=utc) |
1491 | 47 | announcement = product.announce( | 47 | announcement = product.announce( |
1492 | 48 | announcer, "Hello World", publication_date=announced) | 48 | announcer, "Hello World", publication_date=announced) |
1493 | diff --git a/lib/lp/registry/browser/tests/test_branding.py b/lib/lp/registry/browser/tests/test_branding.py | |||
1494 | index 1b2d321..7c1ba39 100644 | |||
1495 | --- a/lib/lp/registry/browser/tests/test_branding.py | |||
1496 | +++ b/lib/lp/registry/browser/tests/test_branding.py | |||
1497 | @@ -14,7 +14,7 @@ class TestBrandingChangeView(TestCaseWithFactory): | |||
1498 | 14 | layer = DatabaseFunctionalLayer | 14 | layer = DatabaseFunctionalLayer |
1499 | 15 | 15 | ||
1500 | 16 | def setUp(self): | 16 | def setUp(self): |
1502 | 17 | super(TestBrandingChangeView, self).setUp() | 17 | super().setUp() |
1503 | 18 | self.context = self.factory.makePerson(name='cow') | 18 | self.context = self.factory.makePerson(name='cow') |
1504 | 19 | self.view = BrandingChangeView(self.context, LaunchpadTestRequest()) | 19 | self.view = BrandingChangeView(self.context, LaunchpadTestRequest()) |
1505 | 20 | 20 | ||
1506 | diff --git a/lib/lp/registry/browser/tests/test_breadcrumbs.py b/lib/lp/registry/browser/tests/test_breadcrumbs.py | |||
1507 | index 459a259..10bd2e9 100644 | |||
1508 | --- a/lib/lp/registry/browser/tests/test_breadcrumbs.py | |||
1509 | +++ b/lib/lp/registry/browser/tests/test_breadcrumbs.py | |||
1510 | @@ -17,7 +17,7 @@ class TestPillarSharingBreadcrumb(BaseBreadcrumbTestCase, SharingBaseTestCase): | |||
1511 | 17 | pillar_type = 'product' | 17 | pillar_type = 'product' |
1512 | 18 | 18 | ||
1513 | 19 | def setUp(self): | 19 | def setUp(self): |
1515 | 20 | super(TestPillarSharingBreadcrumb, self).setUp() | 20 | super().setUp() |
1516 | 21 | login_person(self.driver) | 21 | login_person(self.driver) |
1517 | 22 | 22 | ||
1518 | 23 | def test_sharing_breadcrumb(self): | 23 | def test_sharing_breadcrumb(self): |
1519 | @@ -44,7 +44,7 @@ class TestDistroseriesBreadcrumb(BaseBreadcrumbTestCase): | |||
1520 | 44 | """Test breadcrumbs for an `IDistroseries`.""" | 44 | """Test breadcrumbs for an `IDistroseries`.""" |
1521 | 45 | 45 | ||
1522 | 46 | def setUp(self): | 46 | def setUp(self): |
1524 | 47 | super(TestDistroseriesBreadcrumb, self).setUp() | 47 | super().setUp() |
1525 | 48 | self.distribution = self.factory.makeDistribution( | 48 | self.distribution = self.factory.makeDistribution( |
1526 | 49 | name='youbuntu', displayname='Youbuntu') | 49 | name='youbuntu', displayname='Youbuntu') |
1527 | 50 | self.distroseries = self.factory.makeDistroSeries( | 50 | self.distroseries = self.factory.makeDistroSeries( |
1528 | @@ -61,7 +61,7 @@ class TestDistributionMirrorBreadcrumb(BaseBreadcrumbTestCase): | |||
1529 | 61 | """Test breadcrumbs for an `IDistributionMirror`.""" | 61 | """Test breadcrumbs for an `IDistributionMirror`.""" |
1530 | 62 | 62 | ||
1531 | 63 | def setUp(self): | 63 | def setUp(self): |
1533 | 64 | super(TestDistributionMirrorBreadcrumb, self).setUp() | 64 | super().setUp() |
1534 | 65 | self.distribution = getUtility(ILaunchpadCelebrities).ubuntu | 65 | self.distribution = getUtility(ILaunchpadCelebrities).ubuntu |
1535 | 66 | 66 | ||
1536 | 67 | def test_distributionmirror_withDisplayName(self): | 67 | def test_distributionmirror_withDisplayName(self): |
1537 | @@ -104,7 +104,7 @@ class TestMilestoneBreadcrumb(BaseBreadcrumbTestCase): | |||
1538 | 104 | """Test the breadcrumbs for an `IMilestone`.""" | 104 | """Test the breadcrumbs for an `IMilestone`.""" |
1539 | 105 | 105 | ||
1540 | 106 | def setUp(self): | 106 | def setUp(self): |
1542 | 107 | super(TestMilestoneBreadcrumb, self).setUp() | 107 | super().setUp() |
1543 | 108 | self.project = self.factory.makeProduct() | 108 | self.project = self.factory.makeProduct() |
1544 | 109 | self.series = self.factory.makeProductSeries(product=self.project) | 109 | self.series = self.factory.makeProductSeries(product=self.project) |
1545 | 110 | self.milestone = self.factory.makeMilestone( | 110 | self.milestone = self.factory.makeMilestone( |
1546 | @@ -136,7 +136,7 @@ class TestPollBreadcrumb(BaseBreadcrumbTestCase): | |||
1547 | 136 | """Test breadcrumbs for an `IPoll`.""" | 136 | """Test breadcrumbs for an `IPoll`.""" |
1548 | 137 | 137 | ||
1549 | 138 | def setUp(self): | 138 | def setUp(self): |
1551 | 139 | super(TestPollBreadcrumb, self).setUp() | 139 | super().setUp() |
1552 | 140 | self.team = self.factory.makeTeam(displayname="Poll Team") | 140 | self.team = self.factory.makeTeam(displayname="Poll Team") |
1553 | 141 | name = "pollo-poll" | 141 | name = "pollo-poll" |
1554 | 142 | title = "Marco Pollo" | 142 | title = "Marco Pollo" |
1555 | @@ -157,7 +157,7 @@ class TestNameblacklistBreadcrumb(BaseBreadcrumbTestCase): | |||
1556 | 157 | """Test breadcrumbs for +nameblacklist.""" | 157 | """Test breadcrumbs for +nameblacklist.""" |
1557 | 158 | 158 | ||
1558 | 159 | def setUp(self): | 159 | def setUp(self): |
1560 | 160 | super(TestNameblacklistBreadcrumb, self).setUp() | 160 | super().setUp() |
1561 | 161 | self.name_blacklist_set = getUtility(INameBlacklistSet) | 161 | self.name_blacklist_set = getUtility(INameBlacklistSet) |
1562 | 162 | self.registry_expert = self.factory.makeRegistryExpert() | 162 | self.registry_expert = self.factory.makeRegistryExpert() |
1563 | 163 | login_person(self.registry_expert) | 163 | login_person(self.registry_expert) |
1564 | @@ -167,7 +167,7 @@ class TestNameblacklistBreadcrumb(BaseBreadcrumbTestCase): | |||
1565 | 167 | self.assertBreadcrumbs(expected, self.name_blacklist_set) | 167 | self.assertBreadcrumbs(expected, self.name_blacklist_set) |
1566 | 168 | 168 | ||
1567 | 169 | def test_nameblacklist_edit(self): | 169 | def test_nameblacklist_edit(self): |
1569 | 170 | blacklist = self.name_blacklist_set.getByRegExp(u'blacklist') | 170 | blacklist = self.name_blacklist_set.getByRegExp('blacklist') |
1570 | 171 | expected = [ | 171 | expected = [ |
1571 | 172 | ('Name Blacklist', | 172 | ('Name Blacklist', |
1572 | 173 | 'http://launchpad.test/+nameblacklist'), | 173 | 'http://launchpad.test/+nameblacklist'), |
1573 | diff --git a/lib/lp/registry/browser/tests/test_codeofconduct.py b/lib/lp/registry/browser/tests/test_codeofconduct.py | |||
1574 | index f52b93b..b270f70 100644 | |||
1575 | --- a/lib/lp/registry/browser/tests/test_codeofconduct.py | |||
1576 | +++ b/lib/lp/registry/browser/tests/test_codeofconduct.py | |||
1577 | @@ -25,7 +25,7 @@ class TestSignedCodeOfConductAckView(TestCaseWithFactory): | |||
1578 | 25 | layer = DatabaseFunctionalLayer | 25 | layer = DatabaseFunctionalLayer |
1579 | 26 | 26 | ||
1580 | 27 | def setUp(self): | 27 | def setUp(self): |
1582 | 28 | super(TestSignedCodeOfConductAckView, self).setUp() | 28 | super().setUp() |
1583 | 29 | self.signed_coc_set = getUtility(ISignedCodeOfConductSet) | 29 | self.signed_coc_set = getUtility(ISignedCodeOfConductSet) |
1584 | 30 | self.owner = self.factory.makePerson() | 30 | self.owner = self.factory.makePerson() |
1585 | 31 | self.admin = login_celebrity('admin') | 31 | self.admin = login_celebrity('admin') |
1586 | @@ -60,7 +60,7 @@ class SignCodeOfConductTestCase(TestCaseWithFactory): | |||
1587 | 60 | layer = DatabaseFunctionalLayer | 60 | layer = DatabaseFunctionalLayer |
1588 | 61 | 61 | ||
1589 | 62 | def setUp(self): | 62 | def setUp(self): |
1591 | 63 | super(SignCodeOfConductTestCase, self).setUp() | 63 | super().setUp() |
1592 | 64 | user = self.factory.makePerson() | 64 | user = self.factory.makePerson() |
1593 | 65 | gpg_key = self.factory.makeGPGKey(user) | 65 | gpg_key = self.factory.makeGPGKey(user) |
1594 | 66 | self.signed_coc = self.sign_coc(user, gpg_key) | 66 | self.signed_coc = self.sign_coc(user, gpg_key) |
1595 | diff --git a/lib/lp/registry/browser/tests/test_distribution.py b/lib/lp/registry/browser/tests/test_distribution.py | |||
1596 | index f75dce0..3f3ac9c 100644 | |||
1597 | --- a/lib/lp/registry/browser/tests/test_distribution.py | |||
1598 | +++ b/lib/lp/registry/browser/tests/test_distribution.py | |||
1599 | @@ -336,9 +336,9 @@ class TestDistributionPage(TestCaseWithFactory): | |||
1600 | 336 | layer = DatabaseFunctionalLayer | 336 | layer = DatabaseFunctionalLayer |
1601 | 337 | 337 | ||
1602 | 338 | def setUp(self): | 338 | def setUp(self): |
1604 | 339 | super(TestDistributionPage, self).setUp() | 339 | super().setUp() |
1605 | 340 | self.distro = self.factory.makeDistribution( | 340 | self.distro = self.factory.makeDistribution( |
1607 | 341 | name="distro", displayname=u'distro') | 341 | name="distro", displayname='distro') |
1608 | 342 | self.simple_user = self.factory.makePerson() | 342 | self.simple_user = self.factory.makePerson() |
1609 | 343 | # Use a FakeLogger fixture to prevent Memcached warnings to be | 343 | # Use a FakeLogger fixture to prevent Memcached warnings to be |
1610 | 344 | # printed to stdout while browsing pages. | 344 | # printed to stdout while browsing pages. |
1611 | @@ -510,9 +510,9 @@ class TestDistributionView(TestCaseWithFactory): | |||
1612 | 510 | layer = DatabaseFunctionalLayer | 510 | layer = DatabaseFunctionalLayer |
1613 | 511 | 511 | ||
1614 | 512 | def setUp(self): | 512 | def setUp(self): |
1616 | 513 | super(TestDistributionView, self).setUp() | 513 | super().setUp() |
1617 | 514 | self.distro = self.factory.makeDistribution( | 514 | self.distro = self.factory.makeDistribution( |
1619 | 515 | name="distro", displayname=u'distro') | 515 | name="distro", displayname='distro') |
1620 | 516 | 516 | ||
1621 | 517 | def test_view_data_model(self): | 517 | def test_view_data_model(self): |
1622 | 518 | # The view's json request cache contains the expected data. | 518 | # The view's json request cache contains the expected data. |
1623 | diff --git a/lib/lp/registry/browser/tests/test_distribution_views.py b/lib/lp/registry/browser/tests/test_distribution_views.py | |||
1624 | index ad7956d..252bf72 100644 | |||
1625 | --- a/lib/lp/registry/browser/tests/test_distribution_views.py | |||
1626 | +++ b/lib/lp/registry/browser/tests/test_distribution_views.py | |||
1627 | @@ -38,13 +38,13 @@ class TestDistributionPublisherConfigView(TestCaseWithFactory): | |||
1628 | 38 | 38 | ||
1629 | 39 | def setUp(self): | 39 | def setUp(self): |
1630 | 40 | # Create a test distribution. | 40 | # Create a test distribution. |
1632 | 41 | super(TestDistributionPublisherConfigView, self).setUp() | 41 | super().setUp() |
1633 | 42 | self.distro = self.factory.makeDistribution(no_pubconf=True) | 42 | self.distro = self.factory.makeDistribution(no_pubconf=True) |
1634 | 43 | login(LAUNCHPAD_ADMIN) | 43 | login(LAUNCHPAD_ADMIN) |
1635 | 44 | 44 | ||
1639 | 45 | self.ROOT_DIR = u"rootdir/test" | 45 | self.ROOT_DIR = "rootdir/test" |
1640 | 46 | self.BASE_URL = u"http://base.url" | 46 | self.BASE_URL = "http://base.url" |
1641 | 47 | self.COPY_BASE_URL = u"http://copybase.url" | 47 | self.COPY_BASE_URL = "http://copybase.url" |
1642 | 48 | 48 | ||
1643 | 49 | def test_empty_initial_values(self): | 49 | def test_empty_initial_values(self): |
1644 | 50 | # Test that the page will display empty field values with no | 50 | # Test that the page will display empty field values with no |
1645 | @@ -53,7 +53,7 @@ class TestDistributionPublisherConfigView(TestCaseWithFactory): | |||
1646 | 53 | self.distro, LaunchpadTestRequest()) | 53 | self.distro, LaunchpadTestRequest()) |
1647 | 54 | 54 | ||
1648 | 55 | for value in view.initial_values: | 55 | for value in view.initial_values: |
1650 | 56 | self.assertEqual(u"", value) | 56 | self.assertEqual("", value) |
1651 | 57 | 57 | ||
1652 | 58 | def test_previous_initial_values(self): | 58 | def test_previous_initial_values(self): |
1653 | 59 | # Test that the initial values are the same as the ones in the | 59 | # Test that the initial values are the same as the ones in the |
1654 | @@ -96,9 +96,9 @@ class TestDistributionPublisherConfigView(TestCaseWithFactory): | |||
1655 | 96 | # Test POSTing to change existing config. | 96 | # Test POSTing to change existing config. |
1656 | 97 | self.factory.makePublisherConfig( | 97 | self.factory.makePublisherConfig( |
1657 | 98 | distribution=self.distro, | 98 | distribution=self.distro, |
1661 | 99 | root_dir=u"random", | 99 | root_dir="random", |
1662 | 100 | base_url=u"blah", | 100 | base_url="blah", |
1663 | 101 | copy_base_url=u"foo", | 101 | copy_base_url="foo", |
1664 | 102 | ) | 102 | ) |
1665 | 103 | self._change_and_test_config() | 103 | self._change_and_test_config() |
1666 | 104 | 104 | ||
1667 | @@ -109,7 +109,7 @@ class TestDistroAddView(TestCaseWithFactory): | |||
1668 | 109 | layer = DatabaseFunctionalLayer | 109 | layer = DatabaseFunctionalLayer |
1669 | 110 | 110 | ||
1670 | 111 | def setUp(self): | 111 | def setUp(self): |
1672 | 112 | super(TestDistroAddView, self).setUp() | 112 | super().setUp() |
1673 | 113 | self.owner = self.factory.makePerson() | 113 | self.owner = self.factory.makePerson() |
1674 | 114 | self.registrant = self.factory.makePerson() | 114 | self.registrant = self.factory.makePerson() |
1675 | 115 | self.simple_user = self.factory.makePerson() | 115 | self.simple_user = self.factory.makePerson() |
1676 | @@ -189,7 +189,7 @@ class TestDistroEditView(OCIConfigHelperMixin, TestCaseWithFactory): | |||
1677 | 189 | layer = DatabaseFunctionalLayer | 189 | layer = DatabaseFunctionalLayer |
1678 | 190 | 190 | ||
1679 | 191 | def setUp(self): | 191 | def setUp(self): |
1681 | 192 | super(TestDistroEditView, self).setUp() | 192 | super().setUp() |
1682 | 193 | self.admin = login_celebrity('admin') | 193 | self.admin = login_celebrity('admin') |
1683 | 194 | self.oci_admins = self.factory.makeTeam( | 194 | self.oci_admins = self.factory.makeTeam( |
1684 | 195 | members=[self.admin]) | 195 | members=[self.admin]) |
1685 | @@ -226,7 +226,7 @@ class TestDistroEditView(OCIConfigHelperMixin, TestCaseWithFactory): | |||
1686 | 226 | 'field.title': 'newbuntu', | 226 | 'field.title': 'newbuntu', |
1687 | 227 | 'field.summary': 'newbuntu', | 227 | 'field.summary': 'newbuntu', |
1688 | 228 | 'field.description': 'newbuntu', | 228 | 'field.description': 'newbuntu', |
1690 | 229 | 'field.require_virtualized.used': u'', | 229 | 'field.require_virtualized.used': '', |
1691 | 230 | 'field.processors': [proc.name for proc in self.all_processors], | 230 | 'field.processors': [proc.name for proc in self.all_processors], |
1692 | 231 | 'field.actions.change': 'Change', | 231 | 'field.actions.change': 'Change', |
1693 | 232 | } | 232 | } |
1694 | @@ -496,7 +496,7 @@ class TestDistroReassignView(TestCaseWithFactory): | |||
1695 | 496 | layer = DatabaseFunctionalLayer | 496 | layer = DatabaseFunctionalLayer |
1696 | 497 | 497 | ||
1697 | 498 | def setUp(self): | 498 | def setUp(self): |
1699 | 499 | super(TestDistroReassignView, self).setUp() | 499 | super().setUp() |
1700 | 500 | self.owner = self.factory.makePerson() | 500 | self.owner = self.factory.makePerson() |
1701 | 501 | self.registrant = self.factory.makePerson() | 501 | self.registrant = self.factory.makePerson() |
1702 | 502 | self.simple_user = self.factory.makePerson() | 502 | self.simple_user = self.factory.makePerson() |
1703 | diff --git a/lib/lp/registry/browser/tests/test_distributionsourcepackage.py b/lib/lp/registry/browser/tests/test_distributionsourcepackage.py | |||
1704 | index 0ae0087..3de69df 100644 | |||
1705 | --- a/lib/lp/registry/browser/tests/test_distributionsourcepackage.py | |||
1706 | +++ b/lib/lp/registry/browser/tests/test_distributionsourcepackage.py | |||
1707 | @@ -42,8 +42,8 @@ class TestDistributionSourcePackageFormatterAPI(TestCaseWithFactory): | |||
1708 | 42 | ubuntu = getUtility(ILaunchpadCelebrities).ubuntu | 42 | ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
1709 | 43 | dsp = ubuntu.getSourcePackage('mouse') | 43 | dsp = ubuntu.getSourcePackage('mouse') |
1710 | 44 | markup = ( | 44 | markup = ( |
1713 | 45 | u'<a href="/ubuntu/+source/mouse" class="sprite package-source">' | 45 | '<a href="/ubuntu/+source/mouse" class="sprite package-source">' |
1714 | 46 | u'mouse in Ubuntu</a>') | 46 | 'mouse in Ubuntu</a>') |
1715 | 47 | self.assertEqual(markup, test_tales('dsp/fmt:link', dsp=dsp)) | 47 | self.assertEqual(markup, test_tales('dsp/fmt:link', dsp=dsp)) |
1716 | 48 | 48 | ||
1717 | 49 | 49 | ||
1718 | @@ -157,7 +157,7 @@ class TestDistributionSourceView(TestCaseWithFactory): | |||
1719 | 157 | layer = DatabaseFunctionalLayer | 157 | layer = DatabaseFunctionalLayer |
1720 | 158 | 158 | ||
1721 | 159 | def setUp(self): | 159 | def setUp(self): |
1723 | 160 | super(TestDistributionSourceView, self).setUp() | 160 | super().setUp() |
1724 | 161 | self.factory.makeSourcePackageName('mouse') | 161 | self.factory.makeSourcePackageName('mouse') |
1725 | 162 | distro = self.factory.makeDistribution() | 162 | distro = self.factory.makeDistribution() |
1726 | 163 | self.dsp = distro.getSourcePackage('mouse') | 163 | self.dsp = distro.getSourcePackage('mouse') |
1727 | diff --git a/lib/lp/registry/browser/tests/test_distroseries.py b/lib/lp/registry/browser/tests/test_distroseries.py | |||
1728 | index e0d714e..326bbfd 100644 | |||
1729 | --- a/lib/lp/registry/browser/tests/test_distroseries.py | |||
1730 | +++ b/lib/lp/registry/browser/tests/test_distroseries.py | |||
1731 | @@ -244,7 +244,7 @@ class DistroSeriesIndexFunctionalTestCase(TestCaseWithFactory): | |||
1732 | 244 | layer = DatabaseFunctionalLayer | 244 | layer = DatabaseFunctionalLayer |
1733 | 245 | 245 | ||
1734 | 246 | def setUp(self): | 246 | def setUp(self): |
1736 | 247 | super(DistroSeriesIndexFunctionalTestCase, self).setUp() | 247 | super().setUp() |
1737 | 248 | # Use a FakeLogger fixture to prevent Memcached warnings to be | 248 | # Use a FakeLogger fixture to prevent Memcached warnings to be |
1738 | 249 | # printed to stdout while browsing pages. | 249 | # printed to stdout while browsing pages. |
1739 | 250 | self.useFixture(FakeLogger()) | 250 | self.useFixture(FakeLogger()) |
1740 | @@ -501,7 +501,7 @@ class TestDistroSeriesDerivationPortlet(TestCaseWithFactory): | |||
1741 | 501 | job.start() | 501 | job.start() |
1742 | 502 | job.fail() | 502 | job.fail() |
1743 | 503 | with person_logged_in(series.distribution.owner): | 503 | with person_logged_in(series.distribution.owner): |
1745 | 504 | series.distribution.owner.display_name = u"Bob Individual" | 504 | series.distribution.owner.display_name = "Bob Individual" |
1746 | 505 | with anonymous_logged_in(): | 505 | with anonymous_logged_in(): |
1747 | 506 | view = create_initialized_view(series, '+portlet-derivation') | 506 | view = create_initialized_view(series, '+portlet-derivation') |
1748 | 507 | html_content = view() | 507 | html_content = view() |
1749 | @@ -514,7 +514,7 @@ class TestDistroSeriesDerivationPortlet(TestCaseWithFactory): | |||
1750 | 514 | # owner is an individual. | 514 | # owner is an individual. |
1751 | 515 | with person_logged_in(series.distribution.owner): | 515 | with person_logged_in(series.distribution.owner): |
1752 | 516 | series.distribution.owner = self.factory.makeTeam( | 516 | series.distribution.owner = self.factory.makeTeam( |
1754 | 517 | displayname=u"Team Teamy Team Team", | 517 | displayname="Team Teamy Team Team", |
1755 | 518 | membership_policy=TeamMembershipPolicy.RESTRICTED) | 518 | membership_policy=TeamMembershipPolicy.RESTRICTED) |
1756 | 519 | with anonymous_logged_in(): | 519 | with anonymous_logged_in(): |
1757 | 520 | view = create_initialized_view(series, '+portlet-derivation') | 520 | view = create_initialized_view(series, '+portlet-derivation') |
1758 | @@ -614,31 +614,31 @@ class TestDistroSeriesAddView(TestCaseWithFactory): | |||
1759 | 614 | layer = DatabaseFunctionalLayer | 614 | layer = DatabaseFunctionalLayer |
1760 | 615 | 615 | ||
1761 | 616 | def setUp(self): | 616 | def setUp(self): |
1763 | 617 | super(TestDistroSeriesAddView, self).setUp() | 617 | super().setUp() |
1764 | 618 | self.user = self.factory.makePerson() | 618 | self.user = self.factory.makePerson() |
1765 | 619 | self.distribution = self.factory.makeDistribution(owner=self.user) | 619 | self.distribution = self.factory.makeDistribution(owner=self.user) |
1766 | 620 | 620 | ||
1767 | 621 | def createNewDistroseries(self): | 621 | def createNewDistroseries(self): |
1768 | 622 | form = { | 622 | form = { |
1774 | 623 | "field.name": u"polished", | 623 | "field.name": "polished", |
1775 | 624 | "field.version": u"12.04", | 624 | "field.version": "12.04", |
1776 | 625 | "field.display_name": u"Polished Polecat", | 625 | "field.display_name": "Polished Polecat", |
1777 | 626 | "field.summary": u"Even The Register likes it.", | 626 | "field.summary": "Even The Register likes it.", |
1778 | 627 | "field.actions.create": u"Add Series", | 627 | "field.actions.create": "Add Series", |
1779 | 628 | } | 628 | } |
1780 | 629 | with person_logged_in(self.user): | 629 | with person_logged_in(self.user): |
1781 | 630 | create_initialized_view(self.distribution, "+addseries", | 630 | create_initialized_view(self.distribution, "+addseries", |
1782 | 631 | form=form) | 631 | form=form) |
1784 | 632 | distroseries = self.distribution.getSeries(u"polished") | 632 | distroseries = self.distribution.getSeries("polished") |
1785 | 633 | return distroseries | 633 | return distroseries |
1786 | 634 | 634 | ||
1787 | 635 | def assertCreated(self, distroseries): | 635 | def assertCreated(self, distroseries): |
1794 | 636 | self.assertEqual(u"polished", distroseries.name) | 636 | self.assertEqual("polished", distroseries.name) |
1795 | 637 | self.assertEqual(u"12.04", distroseries.version) | 637 | self.assertEqual("12.04", distroseries.version) |
1796 | 638 | self.assertEqual(u"Polished Polecat", distroseries.display_name) | 638 | self.assertEqual("Polished Polecat", distroseries.display_name) |
1797 | 639 | self.assertEqual(u"Polished Polecat", distroseries.title) | 639 | self.assertEqual("Polished Polecat", distroseries.title) |
1798 | 640 | self.assertEqual(u"Even The Register likes it.", distroseries.summary) | 640 | self.assertEqual("Even The Register likes it.", distroseries.summary) |
1799 | 641 | self.assertEqual(u"", distroseries.description) | 641 | self.assertEqual("", distroseries.description) |
1800 | 642 | self.assertEqual(self.user, distroseries.owner) | 642 | self.assertEqual(self.user, distroseries.owner) |
1801 | 643 | 643 | ||
1802 | 644 | def test_plain_submit(self): | 644 | def test_plain_submit(self): |
1803 | @@ -684,10 +684,10 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory): | |||
1804 | 684 | # process Javascript. | 684 | # process Javascript. |
1805 | 685 | [message] = root.cssselect("p.error.message") | 685 | [message] = root.cssselect("p.error.message") |
1806 | 686 | self.assertIn( | 686 | self.assertIn( |
1808 | 687 | u"Javascript is required to use this page", | 687 | "Javascript is required to use this page", |
1809 | 688 | message.text) | 688 | message.text) |
1810 | 689 | self.assertIn( | 689 | self.assertIn( |
1812 | 690 | u"javascript-disabled", | 690 | "javascript-disabled", |
1813 | 691 | message.get("class").split()) | 691 | message.get("class").split()) |
1814 | 692 | 692 | ||
1815 | 693 | def test_seriesToVocab(self): | 693 | def test_seriesToVocab(self): |
1816 | @@ -755,8 +755,8 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory): | |||
1817 | 755 | [message] = root.cssselect("p.error.message") | 755 | [message] = root.cssselect("p.error.message") |
1818 | 756 | self.assertThat( | 756 | self.assertThat( |
1819 | 757 | message.text, EqualsIgnoringWhitespace( | 757 | message.text, EqualsIgnoringWhitespace( |
1822 | 758 | u"This series already contains source packages " | 758 | "This series already contains source packages " |
1823 | 759 | u"and cannot be initialized again.")) | 759 | "and cannot be initialized again.")) |
1824 | 760 | 760 | ||
1825 | 761 | def test_form_hidden_when_distroseries_is_being_initialized(self): | 761 | def test_form_hidden_when_distroseries_is_being_initialized(self): |
1826 | 762 | # The form is hidden when the series has already been derived. | 762 | # The form is hidden when the series has already been derived. |
1827 | @@ -770,7 +770,7 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory): | |||
1828 | 770 | [message] = root.cssselect("p.error.message") | 770 | [message] = root.cssselect("p.error.message") |
1829 | 771 | self.assertThat( | 771 | self.assertThat( |
1830 | 772 | message.text, EqualsIgnoringWhitespace( | 772 | message.text, EqualsIgnoringWhitespace( |
1832 | 773 | u"This series is already being initialized.")) | 773 | "This series is already being initialized.")) |
1833 | 774 | 774 | ||
1834 | 775 | def test_form_hidden_when_previous_series_none(self): | 775 | def test_form_hidden_when_previous_series_none(self): |
1835 | 776 | # If the distribution has an initialized series and the | 776 | # If the distribution has an initialized series and the |
1836 | @@ -789,9 +789,9 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory): | |||
1837 | 789 | [message] = root.cssselect("p.error.message") | 789 | [message] = root.cssselect("p.error.message") |
1838 | 790 | self.assertThat( | 790 | self.assertThat( |
1839 | 791 | message.text, EqualsIgnoringWhitespace( | 791 | message.text, EqualsIgnoringWhitespace( |
1843 | 792 | u'Unable to initialize series: the distribution ' | 792 | 'Unable to initialize series: the distribution ' |
1844 | 793 | u'already has initialized series and this distroseries ' | 793 | 'already has initialized series and this distroseries ' |
1845 | 794 | u'has no previous series.')) | 794 | 'has no previous series.')) |
1846 | 795 | 795 | ||
1847 | 796 | def test_form_hidden_when_no_publisher_config_set_up(self): | 796 | def test_form_hidden_when_no_publisher_config_set_up(self): |
1848 | 797 | # If the distribution has no publisher config set up: | 797 | # If the distribution has no publisher config set up: |
1849 | @@ -807,8 +807,8 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory): | |||
1850 | 807 | [message] = root.cssselect("p.error.message") | 807 | [message] = root.cssselect("p.error.message") |
1851 | 808 | self.assertThat( | 808 | self.assertThat( |
1852 | 809 | message.text, EqualsIgnoringWhitespace( | 809 | message.text, EqualsIgnoringWhitespace( |
1855 | 810 | u"The series' distribution has no publisher configuration. " | 810 | "The series' distribution has no publisher configuration. " |
1856 | 811 | u"Please ask an administrator to set this up.")) | 811 | "Please ask an administrator to set this up.")) |
1857 | 812 | 812 | ||
1858 | 813 | 813 | ||
1859 | 814 | class TestDistroSeriesInitializeViewAccess(TestCaseWithFactory): | 814 | class TestDistroSeriesInitializeViewAccess(TestCaseWithFactory): |
1860 | @@ -817,8 +817,7 @@ class TestDistroSeriesInitializeViewAccess(TestCaseWithFactory): | |||
1861 | 817 | layer = LaunchpadFunctionalLayer | 817 | layer = LaunchpadFunctionalLayer |
1862 | 818 | 818 | ||
1863 | 819 | def setUp(self): | 819 | def setUp(self): |
1866 | 820 | super(TestDistroSeriesInitializeViewAccess, | 820 | super().setUp('foo.bar@canonical.com') |
1865 | 821 | self).setUp('foo.bar@canonical.com') | ||
1867 | 822 | 821 | ||
1868 | 823 | def test_initseries_access_anon(self): | 822 | def test_initseries_access_anon(self): |
1869 | 824 | # Anonymous users cannot access +initseries. | 823 | # Anonymous users cannot access +initseries. |
1870 | @@ -898,8 +897,7 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory, | |||
1871 | 898 | layer = DatabaseFunctionalLayer | 897 | layer = DatabaseFunctionalLayer |
1872 | 899 | 898 | ||
1873 | 900 | def setUp(self): | 899 | def setUp(self): |
1876 | 901 | super(TestDistroSeriesLocalDiffPerformance, | 900 | super().setUp('foo.bar@canonical.com') |
1875 | 902 | self).setUp('foo.bar@canonical.com') | ||
1877 | 903 | self.simple_user = self.factory.makePerson() | 901 | self.simple_user = self.factory.makePerson() |
1878 | 904 | 902 | ||
1879 | 905 | def _assertQueryCount(self, derived_series): | 903 | def _assertQueryCount(self, derived_series): |
1880 | @@ -917,9 +915,9 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory, | |||
1881 | 917 | for index in range(num): | 915 | for index in range(num): |
1882 | 918 | version = self.factory.getUniqueInteger() | 916 | version = self.factory.getUniqueInteger() |
1883 | 919 | versions = { | 917 | versions = { |
1887 | 920 | 'base': u'1.%d' % version, | 918 | 'base': '1.%d' % version, |
1888 | 921 | 'derived': u'1.%dderived1' % version, | 919 | 'derived': '1.%dderived1' % version, |
1889 | 922 | 'parent': u'1.%d-1' % version, | 920 | 'parent': '1.%d-1' % version, |
1890 | 923 | } | 921 | } |
1891 | 924 | dsd = self.factory.makeDistroSeriesDifference( | 922 | dsd = self.factory.makeDistroSeriesDifference( |
1892 | 925 | derived_series=derived_series, | 923 | derived_series=derived_series, |
1893 | @@ -965,8 +963,7 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory, | |||
1894 | 965 | 963 | ||
1895 | 966 | def prepare_statements(rec): | 964 | def prepare_statements(rec): |
1896 | 967 | for statement in rec.statements: | 965 | for statement in rec.statements: |
1899 | 968 | for line in wrapper.wrap(statement): | 966 | yield from wrapper.wrap(statement) |
1898 | 969 | yield line | ||
1900 | 970 | yield "-" * wrapper.width | 967 | yield "-" * wrapper.width |
1901 | 971 | 968 | ||
1902 | 972 | def statement_diff(): | 969 | def statement_diff(): |
1903 | @@ -983,19 +980,19 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory, | |||
1904 | 983 | self.assertThat(recorder1, HasQueryCount(LessThan(30))) | 980 | self.assertThat(recorder1, HasQueryCount(LessThan(30))) |
1905 | 984 | self.addDetail( | 981 | self.addDetail( |
1906 | 985 | "statement-count-0-differences", | 982 | "statement-count-0-differences", |
1908 | 986 | text_content(u"%d" % recorder1.count)) | 983 | text_content("%d" % recorder1.count)) |
1909 | 987 | # Add some differences and render. | 984 | # Add some differences and render. |
1910 | 988 | add_differences(2) | 985 | add_differences(2) |
1911 | 989 | recorder2, batch_size = flush_and_render() | 986 | recorder2, batch_size = flush_and_render() |
1912 | 990 | self.addDetail( | 987 | self.addDetail( |
1913 | 991 | "statement-count-2-differences", | 988 | "statement-count-2-differences", |
1915 | 992 | text_content(u"%d" % recorder2.count)) | 989 | text_content("%d" % recorder2.count)) |
1916 | 993 | # Add more differences and render again. | 990 | # Add more differences and render again. |
1917 | 994 | add_differences(2) | 991 | add_differences(2) |
1918 | 995 | recorder3, batch_size = flush_and_render() | 992 | recorder3, batch_size = flush_and_render() |
1919 | 996 | self.addDetail( | 993 | self.addDetail( |
1920 | 997 | "statement-count-4-differences", | 994 | "statement-count-4-differences", |
1922 | 998 | text_content(u"%d" % recorder3.count)) | 995 | text_content("%d" % recorder3.count)) |
1923 | 999 | # The last render should not need more queries than the previous. | 996 | # The last render should not need more queries than the previous. |
1924 | 1000 | self.addDetail( | 997 | self.addDetail( |
1925 | 1001 | "statement-diff", Content( | 998 | "statement-diff", Content( |
1926 | @@ -1005,7 +1002,7 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory, | |||
1927 | 1005 | (recorder3.count - recorder1.count) / float(batch_size)) | 1002 | (recorder3.count - recorder1.count) / float(batch_size)) |
1928 | 1006 | self.addDetail( | 1003 | self.addDetail( |
1929 | 1007 | "statement-count-per-row-average", | 1004 | "statement-count-per-row-average", |
1931 | 1008 | text_content(u"%.2f" % statement_count_per_row)) | 1005 | text_content("%.2f" % statement_count_per_row)) |
1932 | 1009 | # Query count is ~O(1) (i.e. not dependent of the number of | 1006 | # Query count is ~O(1) (i.e. not dependent of the number of |
1933 | 1010 | # differences displayed). | 1007 | # differences displayed). |
1934 | 1011 | self.assertThat(recorder3, HasQueryCount.byEquality(recorder2)) | 1008 | self.assertThat(recorder3, HasQueryCount.byEquality(recorder2)) |
1935 | @@ -1099,7 +1096,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory, | |||
1936 | 1099 | def test_parent_packagesets_localpackagediffs_sorts(self): | 1096 | def test_parent_packagesets_localpackagediffs_sorts(self): |
1937 | 1100 | # Multiple packagesets are sorted in a comma separated list. | 1097 | # Multiple packagesets are sorted in a comma separated list. |
1938 | 1101 | ds_diff = self.factory.makeDistroSeriesDifference() | 1098 | ds_diff = self.factory.makeDistroSeriesDifference() |
1940 | 1102 | unsorted_names = [u"zzz", u"aaa"] | 1099 | unsorted_names = ["zzz", "aaa"] |
1941 | 1103 | with celebrity_logged_in('admin'): | 1100 | with celebrity_logged_in('admin'): |
1942 | 1104 | for name in unsorted_names: | 1101 | for name in unsorted_names: |
1943 | 1105 | self.factory.makePackageset( | 1102 | self.factory.makePackageset( |
1944 | @@ -1203,8 +1200,8 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory, | |||
1945 | 1203 | rows = diff_table.tbody.find_all('tr') | 1200 | rows = diff_table.tbody.find_all('tr') |
1946 | 1204 | 1201 | ||
1947 | 1205 | self.assertEqual(1, len(rows)) | 1202 | self.assertEqual(1, len(rows)) |
1950 | 1206 | self.assertIn("Latest comment", six.text_type(rows[0])) | 1203 | self.assertIn("Latest comment", str(rows[0])) |
1951 | 1207 | self.assertNotIn("Earlier comment", six.text_type(rows[0])) | 1204 | self.assertNotIn("Earlier comment", str(rows[0])) |
1952 | 1208 | 1205 | ||
1953 | 1209 | def test_diff_row_links_to_extra_details(self): | 1206 | def test_diff_row_links_to_extra_details(self): |
1954 | 1210 | # The source package name links to the difference details. | 1207 | # The source package name links to the difference details. |
1955 | @@ -1227,9 +1224,9 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory, | |||
1956 | 1227 | derived_series, parent_series = self._createChildAndParents( | 1224 | derived_series, parent_series = self._createChildAndParents( |
1957 | 1228 | other_parent_series=other_parent_series) | 1225 | other_parent_series=other_parent_series) |
1958 | 1229 | versions = { | 1226 | versions = { |
1962 | 1230 | 'base': u'1.0', | 1227 | 'base': '1.0', |
1963 | 1231 | 'derived': u'1.0derived1', | 1228 | 'derived': '1.0derived1', |
1964 | 1232 | 'parent': u'1.0-1', | 1229 | 'parent': '1.0-1', |
1965 | 1233 | } | 1230 | } |
1966 | 1234 | 1231 | ||
1967 | 1235 | self.factory.makeDistroSeriesDifference( | 1232 | self.factory.makeDistroSeriesDifference( |
1968 | @@ -1264,11 +1261,11 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory, | |||
1969 | 1264 | package_name = 'package-1' | 1261 | package_name = 'package-1' |
1970 | 1265 | derived_series, parent_series = self._createChildAndParent() | 1262 | derived_series, parent_series = self._createChildAndParent() |
1971 | 1266 | versions = { | 1263 | versions = { |
1975 | 1267 | 'base': u'1.0', | 1264 | 'base': '1.0', |
1976 | 1268 | 'derived': u'1.0derived1', | 1265 | 'derived': '1.0derived1', |
1977 | 1269 | 'parent': u'1.0-1', | 1266 | 'parent': '1.0-1', |
1978 | 1270 | } | 1267 | } |
1980 | 1271 | new_version = u'1.2' | 1268 | new_version = '1.2' |
1981 | 1272 | 1269 | ||
1982 | 1273 | difference = self.factory.makeDistroSeriesDifference( | 1270 | difference = self.factory.makeDistroSeriesDifference( |
1983 | 1274 | versions=versions, | 1271 | versions=versions, |
1984 | @@ -1307,9 +1304,9 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory, | |||
1985 | 1307 | package_name = 'package-1' | 1304 | package_name = 'package-1' |
1986 | 1308 | derived_series, parent_series = self._createChildAndParent() | 1305 | derived_series, parent_series = self._createChildAndParent() |
1987 | 1309 | versions = { | 1306 | versions = { |
1991 | 1310 | 'base': u'1.0', | 1307 | 'base': '1.0', |
1992 | 1311 | 'derived': u'1.0derived1', | 1308 | 'derived': '1.0derived1', |
1993 | 1312 | 'parent': u'1.0-1', | 1309 | 'parent': '1.0-1', |
1994 | 1313 | } | 1310 | } |
1995 | 1314 | 1311 | ||
1996 | 1315 | difference = self.factory.makeDistroSeriesDifference( | 1312 | difference = self.factory.makeDistroSeriesDifference( |
1997 | @@ -1407,7 +1404,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory, | |||
1998 | 1407 | """Enable the feature flag for derived-series upgrade.""" | 1404 | """Enable the feature flag for derived-series upgrade.""" |
1999 | 1408 | self.useFixture( | 1405 | self.useFixture( |
2000 | 1409 | FeatureFixture( | 1406 | FeatureFixture( |
2002 | 1410 | {u'soyuz.derived_series_upgrade.enabled': u'on'})) | 1407 | {'soyuz.derived_series_upgrade.enabled': 'on'})) |
2003 | 1411 | 1408 | ||
2004 | 1412 | @with_celebrity_logged_in("admin") | 1409 | @with_celebrity_logged_in("admin") |
2005 | 1413 | def test_upgrades_offered_only_with_feature_flag(self): | 1410 | def test_upgrades_offered_only_with_feature_flag(self): |
2006 | @@ -1544,7 +1541,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory, | |||
2007 | 1544 | '+localpackagediffs') | 1541 | '+localpackagediffs') |
2008 | 1545 | 1542 | ||
2009 | 1546 | radio_title = ( | 1543 | radio_title = ( |
2011 | 1547 | u"\xa0Ignored packages with a higher version than in 'Lucid'") | 1544 | "\xa0Ignored packages with a higher version than in 'Lucid'") |
2012 | 1548 | radio_option_matches = soupmatchers.HTMLContains( | 1545 | radio_option_matches = soupmatchers.HTMLContains( |
2013 | 1549 | soupmatchers.Tag( | 1546 | soupmatchers.Tag( |
2014 | 1550 | "radio displays parent's name", 'label', | 1547 | "radio displays parent's name", 'label', |
2015 | @@ -1562,7 +1559,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory, | |||
2016 | 1562 | '+localpackagediffs') | 1559 | '+localpackagediffs') |
2017 | 1563 | 1560 | ||
2018 | 1564 | radio_title = ( | 1561 | radio_title = ( |
2020 | 1565 | u"\xa0Ignored packages with a higher version than in parent") | 1562 | "\xa0Ignored packages with a higher version than in parent") |
2021 | 1566 | radio_option_matches = soupmatchers.HTMLContains( | 1563 | radio_option_matches = soupmatchers.HTMLContains( |
2022 | 1567 | soupmatchers.Tag( | 1564 | soupmatchers.Tag( |
2023 | 1568 | "radio displays parent's name", 'label', | 1565 | "radio displays parent's name", 'label', |
2024 | @@ -2085,7 +2082,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory, | |||
2025 | 2085 | 2082 | ||
2026 | 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. |
2027 | 2087 | pubs = derived_series.main_archive.getPublishedSources( | 2084 | pubs = derived_series.main_archive.getPublishedSources( |
2029 | 2088 | name=u'my-src-name', version=versions['parent'], | 2085 | name='my-src-name', version=versions['parent'], |
2030 | 2089 | distroseries=derived_series).any() | 2086 | distroseries=derived_series).any() |
2031 | 2090 | self.assertIs(None, pubs) | 2087 | self.assertIs(None, pubs) |
2032 | 2091 | 2088 | ||
2033 | @@ -2144,7 +2141,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory, | |||
2034 | 2144 | self._syncAndGetView( | 2141 | self._syncAndGetView( |
2035 | 2145 | derived_series, person, [diff_id]) | 2142 | derived_series, person, [diff_id]) |
2036 | 2146 | parent_series.main_archive.getPublishedSources( | 2143 | parent_series.main_archive.getPublishedSources( |
2038 | 2147 | name=u'my-src-name', version=versions['parent'], | 2144 | name='my-src-name', version=versions['parent'], |
2039 | 2148 | distroseries=parent_series).one() | 2145 | distroseries=parent_series).one() |
2040 | 2149 | 2146 | ||
2041 | 2150 | # We look for a PackageCopyJob with the right metadata. | 2147 | # We look for a PackageCopyJob with the right metadata. |
2042 | @@ -2274,7 +2271,7 @@ class TestCopyAsynchronouslyMessage(TestCaseWithFactory): | |||
2043 | 2274 | layer = DatabaseFunctionalLayer | 2271 | layer = DatabaseFunctionalLayer |
2044 | 2275 | 2272 | ||
2045 | 2276 | def setUp(self): | 2273 | def setUp(self): |
2047 | 2277 | super(TestCopyAsynchronouslyMessage, self).setUp() | 2274 | super().setUp() |
2048 | 2278 | self.archive = self.factory.makeArchive() | 2275 | self.archive = self.factory.makeArchive() |
2049 | 2279 | self.series = self.factory.makeDistroSeries() | 2276 | self.series = self.factory.makeDistroSeries() |
2050 | 2280 | self.series_url = canonical_url(self.series) | 2277 | self.series_url = canonical_url(self.series) |
2051 | @@ -2388,8 +2385,7 @@ class DistroSeriesMissingPackagesPageTestCase(TestCaseWithFactory, | |||
2052 | 2388 | layer = LaunchpadFunctionalLayer | 2385 | layer = LaunchpadFunctionalLayer |
2053 | 2389 | 2386 | ||
2054 | 2390 | def setUp(self): | 2387 | def setUp(self): |
2057 | 2391 | super(DistroSeriesMissingPackagesPageTestCase, | 2388 | super().setUp('foo.bar@canonical.com') |
2056 | 2392 | self).setUp('foo.bar@canonical.com') | ||
2058 | 2393 | self.simple_user = self.factory.makePerson() | 2389 | self.simple_user = self.factory.makePerson() |
2059 | 2394 | 2390 | ||
2060 | 2395 | def test_parent_packagesets_missingpackages(self): | 2391 | def test_parent_packagesets_missingpackages(self): |
2061 | @@ -2552,8 +2548,7 @@ class DistroSeriesUniquePackagesPageTestCase(TestCaseWithFactory, | |||
2062 | 2552 | layer = DatabaseFunctionalLayer | 2548 | layer = DatabaseFunctionalLayer |
2063 | 2553 | 2549 | ||
2064 | 2554 | def setUp(self): | 2550 | def setUp(self): |
2067 | 2555 | super(DistroSeriesUniquePackagesPageTestCase, | 2551 | super().setUp('foo.bar@canonical.com') |
2066 | 2556 | self).setUp('foo.bar@canonical.com') | ||
2068 | 2557 | self.simple_user = self.factory.makePerson() | 2552 | self.simple_user = self.factory.makePerson() |
2069 | 2558 | 2553 | ||
2070 | 2559 | def test_packagesets_uniquepackages(self): | 2554 | def test_packagesets_uniquepackages(self): |
2071 | diff --git a/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py b/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py | |||
2072 | index 766caac..ea2e246 100644 | |||
2073 | --- a/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py | |||
2074 | +++ b/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py | |||
2075 | @@ -108,8 +108,8 @@ class DistroSeriesDifferenceTestCase(TestCaseWithFactory): | |||
2076 | 108 | 108 | ||
2077 | 109 | self.assertIsNot(None, view.binary_summaries) | 109 | self.assertIsNot(None, view.binary_summaries) |
2078 | 110 | self.assertEqual([ | 110 | self.assertEqual([ |
2081 | 111 | u'flubber-bin: summary for flubber-bin', | 111 | 'flubber-bin: summary for flubber-bin', |
2082 | 112 | u'flubber-lib: summary for flubber-lib', | 112 | 'flubber-lib: summary for flubber-lib', |
2083 | 113 | ], view.binary_summaries) | 113 | ], view.binary_summaries) |
2084 | 114 | 114 | ||
2085 | 115 | def test_binary_summaries_for_missing_difference(self): | 115 | def test_binary_summaries_for_missing_difference(self): |
2086 | @@ -124,8 +124,8 @@ class DistroSeriesDifferenceTestCase(TestCaseWithFactory): | |||
2087 | 124 | 124 | ||
2088 | 125 | self.assertIsNot(None, view.binary_summaries) | 125 | self.assertIsNot(None, view.binary_summaries) |
2089 | 126 | self.assertEqual([ | 126 | self.assertEqual([ |
2092 | 127 | u'flubber-bin: summary for flubber-bin', | 127 | 'flubber-bin: summary for flubber-bin', |
2093 | 128 | u'flubber-lib: summary for flubber-lib', | 128 | 'flubber-lib: summary for flubber-lib', |
2094 | 129 | ], view.binary_summaries) | 129 | ], view.binary_summaries) |
2095 | 130 | 130 | ||
2096 | 131 | def test_binary_summaries_no_pubs(self): | 131 | def test_binary_summaries_no_pubs(self): |
2097 | diff --git a/lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py b/lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py | |||
2098 | index 79a74d4..58941cc 100644 | |||
2099 | --- a/lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py | |||
2100 | +++ b/lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py | |||
2101 | @@ -179,40 +179,40 @@ class DistroSeriesDifferenceWebServiceTestCase(TestCaseWithFactory): | |||
2102 | 179 | ws_diff = ws_object(self.factory.makeLaunchpadService( | 179 | ws_diff = ws_object(self.factory.makeLaunchpadService( |
2103 | 180 | self.factory.makePerson()), ds_diff) | 180 | self.factory.makePerson()), ds_diff) |
2104 | 181 | 181 | ||
2106 | 182 | self.assertEqual(u'Blocklisted always', ws_diff.status) | 182 | self.assertEqual('Blocklisted always', ws_diff.status) |
2107 | 183 | 183 | ||
2108 | 184 | def test_exported_sourcepackagename(self): | 184 | def test_exported_sourcepackagename(self): |
2109 | 185 | # The difference's sourcepackagename is exposed. | 185 | # The difference's sourcepackagename is exposed. |
2110 | 186 | ds_diff = self.factory.makeDistroSeriesDifference( | 186 | ds_diff = self.factory.makeDistroSeriesDifference( |
2112 | 187 | source_package_name_str=u'package') | 187 | source_package_name_str='package') |
2113 | 188 | ws_diff = ws_object(self.factory.makeLaunchpadService( | 188 | ws_diff = ws_object(self.factory.makeLaunchpadService( |
2114 | 189 | self.factory.makePerson()), ds_diff) | 189 | self.factory.makePerson()), ds_diff) |
2115 | 190 | 190 | ||
2117 | 191 | self.assertEqual(u'package', ws_diff.sourcepackagename) | 191 | self.assertEqual('package', ws_diff.sourcepackagename) |
2118 | 192 | 192 | ||
2119 | 193 | def test_exported_parent_source_version(self): | 193 | def test_exported_parent_source_version(self): |
2120 | 194 | # The difference's parent_source_version is exposed. | 194 | # The difference's parent_source_version is exposed. |
2121 | 195 | ds_diff = self.factory.makeDistroSeriesDifference( | 195 | ds_diff = self.factory.makeDistroSeriesDifference( |
2123 | 196 | versions={'parent': u'1.1'}) | 196 | versions={'parent': '1.1'}) |
2124 | 197 | ws_diff = ws_object(self.factory.makeLaunchpadService( | 197 | ws_diff = ws_object(self.factory.makeLaunchpadService( |
2125 | 198 | self.factory.makePerson()), ds_diff) | 198 | self.factory.makePerson()), ds_diff) |
2126 | 199 | 199 | ||
2128 | 200 | self.assertEqual(u'1.1', ws_diff.parent_source_version) | 200 | self.assertEqual('1.1', ws_diff.parent_source_version) |
2129 | 201 | 201 | ||
2130 | 202 | def test_exported_source_version(self): | 202 | def test_exported_source_version(self): |
2131 | 203 | # The difference's source_version is exposed. | 203 | # The difference's source_version is exposed. |
2132 | 204 | ds_diff = self.factory.makeDistroSeriesDifference( | 204 | ds_diff = self.factory.makeDistroSeriesDifference( |
2134 | 205 | versions={'derived': u'1.3'}) | 205 | versions={'derived': '1.3'}) |
2135 | 206 | ws_diff = ws_object(self.factory.makeLaunchpadService( | 206 | ws_diff = ws_object(self.factory.makeLaunchpadService( |
2136 | 207 | self.factory.makePerson()), ds_diff) | 207 | self.factory.makePerson()), ds_diff) |
2137 | 208 | 208 | ||
2139 | 209 | self.assertEqual(u'1.3', ws_diff.source_version) | 209 | self.assertEqual('1.3', ws_diff.source_version) |
2140 | 210 | 210 | ||
2141 | 211 | def test_exported_base_version(self): | 211 | def test_exported_base_version(self): |
2142 | 212 | # The difference's base_version is exposed. | 212 | # The difference's base_version is exposed. |
2143 | 213 | ds_diff = self.factory.makeDistroSeriesDifference( | 213 | ds_diff = self.factory.makeDistroSeriesDifference( |
2145 | 214 | versions={'base': u'0.5'}, set_base_version=True) | 214 | versions={'base': '0.5'}, set_base_version=True) |
2146 | 215 | ws_diff = ws_object(self.factory.makeLaunchpadService( | 215 | ws_diff = ws_object(self.factory.makeLaunchpadService( |
2147 | 216 | self.factory.makePerson()), ds_diff) | 216 | self.factory.makePerson()), ds_diff) |
2148 | 217 | 217 | ||
2150 | 218 | self.assertEqual(u'0.5', ws_diff.base_version) | 218 | self.assertEqual('0.5', ws_diff.base_version) |
2151 | diff --git a/lib/lp/registry/browser/tests/test_edit_permissions.py b/lib/lp/registry/browser/tests/test_edit_permissions.py | |||
2152 | index 022daa5..7e41b28 100644 | |||
2153 | --- a/lib/lp/registry/browser/tests/test_edit_permissions.py | |||
2154 | +++ b/lib/lp/registry/browser/tests/test_edit_permissions.py | |||
2155 | @@ -28,7 +28,7 @@ class EditViewPermissionBase(TestCaseWithFactory): | |||
2156 | 28 | layer = DatabaseFunctionalLayer | 28 | layer = DatabaseFunctionalLayer |
2157 | 29 | 29 | ||
2158 | 30 | def setUp(self): | 30 | def setUp(self): |
2160 | 31 | super(EditViewPermissionBase, self).setUp() | 31 | super().setUp() |
2161 | 32 | self.setupTarget() | 32 | self.setupTarget() |
2162 | 33 | self.registry_admin = self.factory.makePerson(name='registry-admin') | 33 | self.registry_admin = self.factory.makePerson(name='registry-admin') |
2163 | 34 | celebs = getUtility(ILaunchpadCelebrities) | 34 | celebs = getUtility(ILaunchpadCelebrities) |
2164 | diff --git a/lib/lp/registry/browser/tests/test_mailinglists.py b/lib/lp/registry/browser/tests/test_mailinglists.py | |||
2165 | index b1154ba..004eb71 100644 | |||
2166 | --- a/lib/lp/registry/browser/tests/test_mailinglists.py | |||
2167 | +++ b/lib/lp/registry/browser/tests/test_mailinglists.py | |||
2168 | @@ -68,7 +68,7 @@ class MailingListSubscriptionControlsTestCase(TestCaseWithFactory): | |||
2169 | 68 | layer = DatabaseFunctionalLayer | 68 | layer = DatabaseFunctionalLayer |
2170 | 69 | 69 | ||
2171 | 70 | def setUp(self): | 70 | def setUp(self): |
2173 | 71 | super(MailingListSubscriptionControlsTestCase, self).setUp() | 71 | super().setUp() |
2174 | 72 | self.a_team = self.factory.makeTeam(name='a') | 72 | self.a_team = self.factory.makeTeam(name='a') |
2175 | 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) |
2176 | 74 | self.b_team_list = self.factory.makeMailingList(team=self.b_team, | 74 | self.b_team_list = self.factory.makeMailingList(team=self.b_team, |
2177 | diff --git a/lib/lp/registry/browser/tests/test_milestone.py b/lib/lp/registry/browser/tests/test_milestone.py | |||
2178 | index e56ac8b..f5c22f6 100644 | |||
2179 | --- a/lib/lp/registry/browser/tests/test_milestone.py | |||
2180 | +++ b/lib/lp/registry/browser/tests/test_milestone.py | |||
2181 | @@ -156,7 +156,7 @@ class TestAddMilestoneViews(TestCaseWithFactory): | |||
2182 | 156 | layer = DatabaseFunctionalLayer | 156 | layer = DatabaseFunctionalLayer |
2183 | 157 | 157 | ||
2184 | 158 | def setUp(self): | 158 | def setUp(self): |
2186 | 159 | super(TestAddMilestoneViews, self).setUp() | 159 | super().setUp() |
2187 | 160 | self.product = self.factory.makeProduct() | 160 | self.product = self.factory.makeProduct() |
2188 | 161 | self.series = self.factory.makeProductSeries(product=self.product) | 161 | self.series = self.factory.makeProductSeries(product=self.product) |
2189 | 162 | self.owner = self.product.owner | 162 | self.owner = self.product.owner |
2190 | @@ -196,7 +196,7 @@ class TestAddMilestoneViews(TestCaseWithFactory): | |||
2191 | 196 | self.assertEqual(expected_msg, error_msg) | 196 | self.assertEqual(expected_msg, error_msg) |
2192 | 197 | 197 | ||
2193 | 198 | def test_add_milestone_with_tags(self): | 198 | def test_add_milestone_with_tags(self): |
2195 | 199 | tags = u'zed alpha' | 199 | tags = 'zed alpha' |
2196 | 200 | form = { | 200 | form = { |
2197 | 201 | 'field.name': '1.1', | 201 | 'field.name': '1.1', |
2198 | 202 | 'field.tags': tags, | 202 | 'field.tags': tags, |
2199 | @@ -222,7 +222,7 @@ class TestMilestoneEditView(TestCaseWithFactory): | |||
2200 | 222 | layer = DatabaseFunctionalLayer | 222 | layer = DatabaseFunctionalLayer |
2201 | 223 | 223 | ||
2202 | 224 | def setUp(self): | 224 | def setUp(self): |
2204 | 225 | super(TestMilestoneEditView, self).setUp() | 225 | super().setUp() |
2205 | 226 | self.product = self.factory.makeProduct() | 226 | self.product = self.factory.makeProduct() |
2206 | 227 | self.milestone = self.factory.makeMilestone( | 227 | self.milestone = self.factory.makeMilestone( |
2207 | 228 | name='orig-name', product=self.product) | 228 | name='orig-name', product=self.product) |
2208 | @@ -230,9 +230,9 @@ class TestMilestoneEditView(TestCaseWithFactory): | |||
2209 | 230 | login_person(self.owner) | 230 | login_person(self.owner) |
2210 | 231 | 231 | ||
2211 | 232 | def test_edit_milestone_with_tags(self): | 232 | def test_edit_milestone_with_tags(self): |
2213 | 233 | orig_tags = u'ba ac' | 233 | orig_tags = 'ba ac' |
2214 | 234 | self.milestone.setTags(orig_tags.split(), self.owner) | 234 | self.milestone.setTags(orig_tags.split(), self.owner) |
2216 | 235 | new_tags = u'za ab' | 235 | new_tags = 'za ab' |
2217 | 236 | form = { | 236 | form = { |
2218 | 237 | 'field.name': 'new-name', | 237 | 'field.name': 'new-name', |
2219 | 238 | 'field.tags': new_tags, | 238 | 'field.tags': new_tags, |
2220 | @@ -245,7 +245,7 @@ class TestMilestoneEditView(TestCaseWithFactory): | |||
2221 | 245 | self.assertEqual(expected, self.milestone.getTags()) | 245 | self.assertEqual(expected, self.milestone.getTags()) |
2222 | 246 | 246 | ||
2223 | 247 | def test_edit_milestone_clear_tags(self): | 247 | def test_edit_milestone_clear_tags(self): |
2225 | 248 | orig_tags = u'ba ac' | 248 | orig_tags = 'ba ac' |
2226 | 249 | self.milestone.setTags(orig_tags.split(), self.owner) | 249 | self.milestone.setTags(orig_tags.split(), self.owner) |
2227 | 250 | form = { | 250 | form = { |
2228 | 251 | 'field.name': 'new-name', | 251 | 'field.name': 'new-name', |
2229 | @@ -365,7 +365,7 @@ class TestProjectMilestoneIndexQueryCount(TestQueryCountBase): | |||
2230 | 365 | layer = DatabaseFunctionalLayer | 365 | layer = DatabaseFunctionalLayer |
2231 | 366 | 366 | ||
2232 | 367 | def setUp(self): | 367 | def setUp(self): |
2234 | 368 | super(TestProjectMilestoneIndexQueryCount, self).setUp() | 368 | super().setUp() |
2235 | 369 | self.owner = self.factory.makePerson(name='product-owner') | 369 | self.owner = self.factory.makePerson(name='product-owner') |
2236 | 370 | self.product = self.factory.makeProduct(owner=self.owner) | 370 | self.product = self.factory.makeProduct(owner=self.owner) |
2237 | 371 | self.product_owner = self.product.owner | 371 | self.product_owner = self.product.owner |
2238 | @@ -481,7 +481,7 @@ class TestProjectGroupMilestoneIndexQueryCount(TestQueryCountBase): | |||
2239 | 481 | layer = DatabaseFunctionalLayer | 481 | layer = DatabaseFunctionalLayer |
2240 | 482 | 482 | ||
2241 | 483 | def setUp(self): | 483 | def setUp(self): |
2243 | 484 | super(TestProjectGroupMilestoneIndexQueryCount, self).setUp() | 484 | super().setUp() |
2244 | 485 | self.owner = self.factory.makePerson(name='product-owner') | 485 | self.owner = self.factory.makePerson(name='product-owner') |
2245 | 486 | self.project_group = self.factory.makeProject(owner=self.owner) | 486 | self.project_group = self.factory.makeProject(owner=self.owner) |
2246 | 487 | login_person(self.owner) | 487 | login_person(self.owner) |
2247 | @@ -539,7 +539,7 @@ class TestDistributionMilestoneIndexQueryCount(TestQueryCountBase): | |||
2248 | 539 | layer = DatabaseFunctionalLayer | 539 | layer = DatabaseFunctionalLayer |
2249 | 540 | 540 | ||
2250 | 541 | def setUp(self): | 541 | def setUp(self): |
2252 | 542 | super(TestDistributionMilestoneIndexQueryCount, self).setUp() | 542 | super().setUp() |
2253 | 543 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu | 543 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
2254 | 544 | self.owner = self.factory.makePerson(name='test-owner') | 544 | self.owner = self.factory.makePerson(name='test-owner') |
2255 | 545 | login_team(self.ubuntu.owner) | 545 | login_team(self.ubuntu.owner) |
2256 | @@ -597,8 +597,8 @@ class TestMilestoneTagView(TestQueryCountBase): | |||
2257 | 597 | layer = DatabaseFunctionalLayer | 597 | layer = DatabaseFunctionalLayer |
2258 | 598 | 598 | ||
2259 | 599 | def setUp(self): | 599 | def setUp(self): |
2262 | 600 | super(TestMilestoneTagView, self).setUp() | 600 | super().setUp() |
2263 | 601 | self.tags = [u'tag1'] | 601 | self.tags = ['tag1'] |
2264 | 602 | self.owner = self.factory.makePerson() | 602 | self.owner = self.factory.makePerson() |
2265 | 603 | self.project_group = self.factory.makeProject(owner=self.owner) | 603 | self.project_group = self.factory.makeProject(owner=self.owner) |
2266 | 604 | self.product = self.factory.makeProduct( | 604 | self.product = self.factory.makeProduct( |
2267 | @@ -620,8 +620,8 @@ class TestMilestoneTagView(TestQueryCountBase): | |||
2268 | 620 | 620 | ||
2269 | 621 | def _make_form(self, tags): | 621 | def _make_form(self, tags): |
2270 | 622 | return { | 622 | return { |
2273 | 623 | u'field.actions.search': u'Search', | 623 | 'field.actions.search': 'Search', |
2274 | 624 | u'field.tags': u' '.join(tags), | 624 | 'field.tags': ' '.join(tags), |
2275 | 625 | } | 625 | } |
2276 | 626 | 626 | ||
2277 | 627 | def _url_tail(self, url, separator='/'): | 627 | def _url_tail(self, url, separator='/'): |
2278 | @@ -636,7 +636,7 @@ class TestMilestoneTagView(TestQueryCountBase): | |||
2279 | 636 | 636 | ||
2280 | 637 | def test_view_form_redirect(self): | 637 | def test_view_form_redirect(self): |
2281 | 638 | # Ensure a correct redirection is performed when tags are searched. | 638 | # Ensure a correct redirection is performed when tags are searched. |
2283 | 639 | tags = [u'tag1', u'tag2'] | 639 | tags = ['tag1', 'tag2'] |
2284 | 640 | form = self._make_form(tags) | 640 | form = self._make_form(tags) |
2285 | 641 | view = create_initialized_view(self.milestonetag, '+index', form=form) | 641 | view = create_initialized_view(self.milestonetag, '+index', form=form) |
2286 | 642 | self.assertEqual(302, view.request.response.getStatus()) | 642 | self.assertEqual(302, view.request.response.getStatus()) |
2287 | @@ -648,7 +648,7 @@ class TestMilestoneTagView(TestQueryCountBase): | |||
2288 | 648 | 648 | ||
2289 | 649 | def test_view_form_error(self): | 649 | def test_view_form_error(self): |
2290 | 650 | # Ensure the form correctly handles invalid submissions. | 650 | # Ensure the form correctly handles invalid submissions. |
2292 | 651 | tags = [u'tag1', u't'] # One char tag is not valid. | 651 | tags = ['tag1', 't'] # One char tag is not valid. |
2293 | 652 | form = self._make_form(tags) | 652 | form = self._make_form(tags) |
2294 | 653 | view = create_initialized_view(self.milestonetag, '+index', form=form) | 653 | view = create_initialized_view(self.milestonetag, '+index', form=form) |
2295 | 654 | self.assertEqual(1, len(view.errors)) | 654 | self.assertEqual(1, len(view.errors)) |
2296 | diff --git a/lib/lp/registry/browser/tests/test_ociproject.py b/lib/lp/registry/browser/tests/test_ociproject.py | |||
2297 | index 4557d1d..05babda 100644 | |||
2298 | --- a/lib/lp/registry/browser/tests/test_ociproject.py | |||
2299 | +++ b/lib/lp/registry/browser/tests/test_ociproject.py | |||
2300 | @@ -85,7 +85,7 @@ class TestOCIProjectView(OCIConfigHelperMixin, BrowserTestCase): | |||
2301 | 85 | layer = DatabaseFunctionalLayer | 85 | layer = DatabaseFunctionalLayer |
2302 | 86 | 86 | ||
2303 | 87 | def setUp(self): | 87 | def setUp(self): |
2305 | 88 | super(TestOCIProjectView, self).setUp() | 88 | super().setUp() |
2306 | 89 | self.setConfig() | 89 | self.setConfig() |
2307 | 90 | 90 | ||
2308 | 91 | def test_facet_top_links(self): | 91 | def test_facet_top_links(self): |
2309 | diff --git a/lib/lp/registry/browser/tests/test_packaging.py b/lib/lp/registry/browser/tests/test_packaging.py | |||
2310 | index 35ffc0c..770ff37 100644 | |||
2311 | --- a/lib/lp/registry/browser/tests/test_packaging.py | |||
2312 | +++ b/lib/lp/registry/browser/tests/test_packaging.py | |||
2313 | @@ -36,12 +36,12 @@ class TestProductSeriesUbuntuPackagingView(WithScenarios, TestCaseWithFactory): | |||
2314 | 36 | scenarios = [ | 36 | scenarios = [ |
2315 | 37 | ("spn_picker", {"features": {}}), | 37 | ("spn_picker", {"features": {}}), |
2316 | 38 | ("dsp_picker", { | 38 | ("dsp_picker", { |
2318 | 39 | "features": {u"disclosure.dsp_picker.enabled": u"on"}, | 39 | "features": {"disclosure.dsp_picker.enabled": "on"}, |
2319 | 40 | }), | 40 | }), |
2320 | 41 | ] | 41 | ] |
2321 | 42 | 42 | ||
2322 | 43 | def setUp(self): | 43 | def setUp(self): |
2324 | 44 | super(TestProductSeriesUbuntuPackagingView, self).setUp() | 44 | super().setUp() |
2325 | 45 | if self.features: | 45 | if self.features: |
2326 | 46 | self.useFixture(FeatureFixture(self.features)) | 46 | self.useFixture(FeatureFixture(self.features)) |
2327 | 47 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu | 47 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
2328 | @@ -150,7 +150,7 @@ class TestBrowserDeletePackaging(TestCaseWithFactory): | |||
2329 | 150 | layer = DatabaseFunctionalLayer | 150 | layer = DatabaseFunctionalLayer |
2330 | 151 | 151 | ||
2331 | 152 | def setUp(self): | 152 | def setUp(self): |
2333 | 153 | super(TestBrowserDeletePackaging, self).setUp() | 153 | super().setUp() |
2334 | 154 | # Only the person which created the packaging, admins | 154 | # Only the person which created the packaging, admins |
2335 | 155 | # and other people with certain privileges can delete a | 155 | # and other people with certain privileges can delete a |
2336 | 156 | # packaging. Since the sample data record we'll use for | 156 | # packaging. Since the sample data record we'll use for |
2337 | diff --git a/lib/lp/registry/browser/tests/test_peoplemerge.py b/lib/lp/registry/browser/tests/test_peoplemerge.py | |||
2338 | index aa359fd..939e432 100644 | |||
2339 | --- a/lib/lp/registry/browser/tests/test_peoplemerge.py | |||
2340 | +++ b/lib/lp/registry/browser/tests/test_peoplemerge.py | |||
2341 | @@ -37,13 +37,13 @@ from lp.testing.views import ( | |||
2342 | 37 | class RequestPeopleMergeMixin(TestCaseWithFactory): | 37 | class RequestPeopleMergeMixin(TestCaseWithFactory): |
2343 | 38 | 38 | ||
2344 | 39 | def setUp(self): | 39 | def setUp(self): |
2346 | 40 | super(RequestPeopleMergeMixin, self).setUp() | 40 | super().setUp() |
2347 | 41 | self.person_set = getUtility(IPersonSet) | 41 | self.person_set = getUtility(IPersonSet) |
2348 | 42 | self.dupe = self.factory.makePerson( | 42 | self.dupe = self.factory.makePerson( |
2349 | 43 | name='foo', email='foo@baz.com') | 43 | name='foo', email='foo@baz.com') |
2350 | 44 | 44 | ||
2351 | 45 | def tearDown(self): | 45 | def tearDown(self): |
2353 | 46 | super(RequestPeopleMergeMixin, self).tearDown() | 46 | super().tearDown() |
2354 | 47 | stub.test_emails = [] | 47 | stub.test_emails = [] |
2355 | 48 | 48 | ||
2356 | 49 | 49 | ||
2357 | @@ -53,7 +53,7 @@ class TestRequestPeopleMergeMultipleEmails(RequestPeopleMergeMixin): | |||
2358 | 53 | layer = DatabaseFunctionalLayer | 53 | layer = DatabaseFunctionalLayer |
2359 | 54 | 54 | ||
2360 | 55 | def setUp(self): | 55 | def setUp(self): |
2362 | 56 | super(TestRequestPeopleMergeMultipleEmails, self).setUp() | 56 | super().setUp() |
2363 | 57 | EmailAddressSet().new( | 57 | EmailAddressSet().new( |
2364 | 58 | 'bar.foo@canonical.com', person=self.dupe, | 58 | 'bar.foo@canonical.com', person=self.dupe, |
2365 | 59 | status=EmailAddressStatus.VALIDATED) | 59 | status=EmailAddressStatus.VALIDATED) |
2366 | @@ -72,8 +72,8 @@ class TestRequestPeopleMergeMultipleEmails(RequestPeopleMergeMixin): | |||
2367 | 72 | explanation = find_tag_by_id(browser.contents, 'explanation') | 72 | explanation = find_tag_by_id(browser.contents, 'explanation') |
2368 | 73 | self.assertThat( | 73 | self.assertThat( |
2369 | 74 | extract_text(explanation), DocTestMatches( | 74 | extract_text(explanation), DocTestMatches( |
2372 | 75 | u"The account..." | 75 | "The account..." |
2373 | 76 | u"has more than one registered email address...")) | 76 | "has more than one registered email address...")) |
2374 | 77 | email_select_control = browser.getControl(name='selected') | 77 | email_select_control = browser.getControl(name='selected') |
2375 | 78 | for ctrl in email_select_control.controls: | 78 | for ctrl in email_select_control.controls: |
2376 | 79 | ctrl.selected = True | 79 | ctrl.selected = True |
2377 | @@ -213,7 +213,7 @@ class TestRequestPeopleMergeHiddenEmailAddresses(RequestPeopleMergeMixin): | |||
2378 | 213 | layer = DatabaseFunctionalLayer | 213 | layer = DatabaseFunctionalLayer |
2379 | 214 | 214 | ||
2380 | 215 | def setUp(self): | 215 | def setUp(self): |
2382 | 216 | super(TestRequestPeopleMergeHiddenEmailAddresses, self).setUp() | 216 | super().setUp() |
2383 | 217 | removeSecurityProxy(self.dupe).hide_email_addresses = True | 217 | removeSecurityProxy(self.dupe).hide_email_addresses = True |
2384 | 218 | EmailAddressSet().new( | 218 | EmailAddressSet().new( |
2385 | 219 | 'bar.foo@canonical.com', person=self.dupe, | 219 | 'bar.foo@canonical.com', person=self.dupe, |
2386 | @@ -257,7 +257,7 @@ class TestValidatingMergeView(TestCaseWithFactory): | |||
2387 | 257 | layer = DatabaseFunctionalLayer | 257 | layer = DatabaseFunctionalLayer |
2388 | 258 | 258 | ||
2389 | 259 | def setUp(self): | 259 | def setUp(self): |
2391 | 260 | super(TestValidatingMergeView, self).setUp() | 260 | super().setUp() |
2392 | 261 | self.person_set = getUtility(IPersonSet) | 261 | self.person_set = getUtility(IPersonSet) |
2393 | 262 | self.dupe = self.factory.makePerson(name='dupe') | 262 | self.dupe = self.factory.makePerson(name='dupe') |
2394 | 263 | self.target = self.factory.makePerson(name='target') | 263 | self.target = self.factory.makePerson(name='target') |
2395 | @@ -281,7 +281,7 @@ class TestValidatingMergeView(TestCaseWithFactory): | |||
2396 | 281 | self.person_set, '+requestmerge', form=self.getForm()) | 281 | self.person_set, '+requestmerge', form=self.getForm()) |
2397 | 282 | self.assertEqual( | 282 | self.assertEqual( |
2398 | 283 | [html_escape( | 283 | [html_escape( |
2400 | 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 " |
2401 | 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 " |
2402 | 286 | "files.")], | 286 | "files.")], |
2403 | 287 | view.errors) | 287 | view.errors) |
2404 | @@ -294,7 +294,7 @@ class TestValidatingMergeView(TestCaseWithFactory): | |||
2405 | 294 | view = create_initialized_view( | 294 | view = create_initialized_view( |
2406 | 295 | self.person_set, '+requestmerge', form=self.getForm()) | 295 | self.person_set, '+requestmerge', form=self.getForm()) |
2407 | 296 | self.assertEqual( | 296 | self.assertEqual( |
2409 | 297 | [u"dupe owns private branches that must be deleted or " | 297 | ["dupe owns private branches that must be deleted or " |
2410 | 298 | "transferred to another owner first."], | 298 | "transferred to another owner first."], |
2411 | 299 | view.errors) | 299 | view.errors) |
2412 | 300 | 300 | ||
2413 | @@ -306,7 +306,7 @@ class TestValidatingMergeView(TestCaseWithFactory): | |||
2414 | 306 | view = create_initialized_view( | 306 | view = create_initialized_view( |
2415 | 307 | self.person_set, '+requestmerge', form=self.getForm()) | 307 | self.person_set, '+requestmerge', form=self.getForm()) |
2416 | 308 | self.assertEqual( | 308 | self.assertEqual( |
2418 | 309 | [u"dupe owns private Git repositories that must be deleted or " | 309 | ["dupe owns private Git repositories that must be deleted or " |
2419 | 310 | "transferred to another owner first."], | 310 | "transferred to another owner first."], |
2420 | 311 | view.errors) | 311 | view.errors) |
2421 | 312 | 312 | ||
2422 | @@ -352,7 +352,7 @@ class TestRequestPeopleMergeMultipleEmailsView(TestCaseWithFactory): | |||
2423 | 352 | layer = DatabaseFunctionalLayer | 352 | layer = DatabaseFunctionalLayer |
2424 | 353 | 353 | ||
2425 | 354 | def setUp(self): | 354 | def setUp(self): |
2427 | 355 | super(TestRequestPeopleMergeMultipleEmailsView, self).setUp() | 355 | super().setUp() |
2428 | 356 | self.personset = getUtility(IPersonSet) | 356 | self.personset = getUtility(IPersonSet) |
2429 | 357 | self.dupe_user = self.factory.makePerson() | 357 | self.dupe_user = self.factory.makePerson() |
2430 | 358 | self.email_2 = self.factory.makeEmail( | 358 | self.email_2 = self.factory.makeEmail( |
2431 | @@ -409,7 +409,7 @@ class TestAdminTeamMergeView(TestCaseWithFactory): | |||
2432 | 409 | layer = DatabaseFunctionalLayer | 409 | layer = DatabaseFunctionalLayer |
2433 | 410 | 410 | ||
2434 | 411 | def setUp(self): | 411 | def setUp(self): |
2436 | 412 | super(TestAdminTeamMergeView, self).setUp() | 412 | super().setUp() |
2437 | 413 | self.person_set = getUtility(IPersonSet) | 413 | self.person_set = getUtility(IPersonSet) |
2438 | 414 | self.dupe_team = self.factory.makeTeam(name='dupe-team') | 414 | self.dupe_team = self.factory.makeTeam(name='dupe-team') |
2439 | 415 | self.target_team = self.factory.makeTeam(name='target-team') | 415 | self.target_team = self.factory.makeTeam(name='target-team') |
2440 | @@ -434,7 +434,7 @@ class TestAdminTeamMergeView(TestCaseWithFactory): | |||
2441 | 434 | view = self.getView() | 434 | view = self.getView() |
2442 | 435 | self.assertEqual( | 435 | self.assertEqual( |
2443 | 436 | [html_escape( | 436 | [html_escape( |
2445 | 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 " |
2446 | 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 " |
2447 | 439 | "files.")], | 439 | "files.")], |
2448 | 440 | view.errors) | 440 | view.errors) |
2449 | @@ -446,7 +446,7 @@ class TestAdminPeopleMergeView(TestCaseWithFactory): | |||
2450 | 446 | layer = DatabaseFunctionalLayer | 446 | layer = DatabaseFunctionalLayer |
2451 | 447 | 447 | ||
2452 | 448 | def setUp(self): | 448 | def setUp(self): |
2454 | 449 | super(TestAdminPeopleMergeView, self).setUp() | 449 | super().setUp() |
2455 | 450 | self.person_set = getUtility(IPersonSet) | 450 | self.person_set = getUtility(IPersonSet) |
2456 | 451 | self.dupe_person = self.factory.makePerson(name='dupe-person') | 451 | self.dupe_person = self.factory.makePerson(name='dupe-person') |
2457 | 452 | self.target_person = self.factory.makePerson() | 452 | self.target_person = self.factory.makePerson() |
2458 | @@ -470,7 +470,7 @@ class TestAdminPeopleMergeView(TestCaseWithFactory): | |||
2459 | 470 | view = self.getView() | 470 | view = self.getView() |
2460 | 471 | self.assertEqual( | 471 | self.assertEqual( |
2461 | 472 | [html_escape( | 472 | [html_escape( |
2463 | 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 " |
2464 | 474 | "be merged. It may take ten minutes to remove the deleted " | 474 | "be merged. It may take ten minutes to remove the deleted " |
2465 | 475 | "PPA's files.")], | 475 | "PPA's files.")], |
2466 | 476 | view.errors) | 476 | view.errors) |
2467 | diff --git a/lib/lp/registry/browser/tests/test_person.py b/lib/lp/registry/browser/tests/test_person.py | |||
2468 | index bed2125..1a1624f 100644 | |||
2469 | --- a/lib/lp/registry/browser/tests/test_person.py | |||
2470 | +++ b/lib/lp/registry/browser/tests/test_person.py | |||
2471 | @@ -593,7 +593,7 @@ class TestPersonViewKarma(TestCaseWithFactory): | |||
2472 | 593 | layer = LaunchpadZopelessLayer | 593 | layer = LaunchpadZopelessLayer |
2473 | 594 | 594 | ||
2474 | 595 | def setUp(self): | 595 | def setUp(self): |
2476 | 596 | super(TestPersonViewKarma, self).setUp() | 596 | super().setUp() |
2477 | 597 | person = self.factory.makePerson() | 597 | person = self.factory.makePerson() |
2478 | 598 | product = self.factory.makeProduct() | 598 | product = self.factory.makeProduct() |
2479 | 599 | transaction.commit() | 599 | transaction.commit() |
2480 | @@ -612,7 +612,7 @@ class TestPersonViewKarma(TestCaseWithFactory): | |||
2481 | 612 | for category in categories: | 612 | for category in categories: |
2482 | 613 | category_names.append(category.name) | 613 | category_names.append(category.name) |
2483 | 614 | 614 | ||
2485 | 615 | self.assertEqual(category_names, [u'code', u'bugs', u'answers'], | 615 | self.assertEqual(category_names, ['code', 'bugs', 'answers'], |
2486 | 616 | 'Categories are not sorted correctly') | 616 | 'Categories are not sorted correctly') |
2487 | 617 | 617 | ||
2488 | 618 | def _makeKarmaCache(self, person, product, category, value=10): | 618 | def _makeKarmaCache(self, person, product, category, value=10): |
2489 | @@ -781,7 +781,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory): | |||
2490 | 781 | layer = LaunchpadFunctionalLayer | 781 | layer = LaunchpadFunctionalLayer |
2491 | 782 | 782 | ||
2492 | 783 | def setUp(self): | 783 | def setUp(self): |
2494 | 784 | super(TestPersonEditView, self).setUp() | 784 | super().setUp() |
2495 | 785 | self.valid_email_address = self.factory.getUniqueEmailAddress() | 785 | self.valid_email_address = self.factory.getUniqueEmailAddress() |
2496 | 786 | self.person = self.factory.makePerson(email=self.valid_email_address) | 786 | self.person = self.factory.makePerson(email=self.valid_email_address) |
2497 | 787 | login_person(self.person) | 787 | login_person(self.person) |
2498 | @@ -846,7 +846,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory): | |||
2499 | 846 | """Special assert function for dealing with email-related errors.""" | 846 | """Special assert function for dealing with email-related errors.""" |
2500 | 847 | view = self.createAddEmailView(email_str) | 847 | view = self.createAddEmailView(email_str) |
2501 | 848 | error_msg = view.errors[0] | 848 | error_msg = view.errors[0] |
2503 | 849 | if not isinstance(error_msg, six.text_type): | 849 | if not isinstance(error_msg, str): |
2504 | 850 | error_msg = error_msg.doc() | 850 | error_msg = error_msg.doc() |
2505 | 851 | self.assertEqual(expected_msg, error_msg) | 851 | self.assertEqual(expected_msg, error_msg) |
2506 | 852 | 852 | ||
2507 | @@ -865,7 +865,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory): | |||
2508 | 865 | notifications = view.request.response.notifications | 865 | notifications = view.request.response.notifications |
2509 | 866 | self.assertEqual(1, len(notifications)) | 866 | self.assertEqual(1, len(notifications)) |
2510 | 867 | expected_msg = html_escape( | 867 | expected_msg = html_escape( |
2512 | 868 | u"A confirmation message has been sent to '%s'." | 868 | "A confirmation message has been sent to '%s'." |
2513 | 869 | " Follow the instructions in that message to confirm" | 869 | " Follow the instructions in that message to confirm" |
2514 | 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" |
2515 | 871 | " few minutes, your mail provider might use 'greylisting', which" | 871 | " few minutes, your mail provider might use 'greylisting', which" |
2516 | @@ -911,7 +911,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory): | |||
2517 | 911 | notifications = view.request.response.notifications | 911 | notifications = view.request.response.notifications |
2518 | 912 | self.assertEqual(1, len(notifications)) | 912 | self.assertEqual(1, len(notifications)) |
2519 | 913 | expected_msg = html_escape( | 913 | expected_msg = html_escape( |
2521 | 914 | u"An email message was sent to '%s' " | 914 | "An email message was sent to '%s' " |
2522 | 915 | "with instructions on how to confirm that it belongs to you." | 915 | "with instructions on how to confirm that it belongs to you." |
2523 | 916 | % added_email) | 916 | % added_email) |
2524 | 917 | self.assertEqual(expected_msg, notifications[0].message) | 917 | self.assertEqual(expected_msg, notifications[0].message) |
2525 | @@ -941,12 +941,12 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory): | |||
2526 | 941 | token_url = get_token_url_from_email(raw_msg) | 941 | token_url = get_token_url_from_email(raw_msg) |
2527 | 942 | browser = setupBrowserForUser(user=self.person) | 942 | browser = setupBrowserForUser(user=self.person) |
2528 | 943 | browser.open(token_url) | 943 | browser.open(token_url) |
2530 | 944 | expected_msg = u'Confirm email address <code>%s</code>' % added_email | 944 | expected_msg = 'Confirm email address <code>%s</code>' % added_email |
2531 | 945 | self.assertIn(expected_msg, browser.contents) | 945 | self.assertIn(expected_msg, browser.contents) |
2532 | 946 | browser.getControl('Continue').click() | 946 | browser.getControl('Continue').click() |
2533 | 947 | # Login again to access displayname, since browser logged us out. | 947 | # Login again to access displayname, since browser logged us out. |
2534 | 948 | login_person(self.person) | 948 | login_person(self.person) |
2536 | 949 | expected_title = u'%s in Launchpad' % self.person.displayname | 949 | expected_title = '%s in Launchpad' % self.person.displayname |
2537 | 950 | self.assertEqual(expected_title, browser.title) | 950 | self.assertEqual(expected_title, browser.title) |
2538 | 951 | 951 | ||
2539 | 952 | def test_remove_unvalidated_email_address(self): | 952 | def test_remove_unvalidated_email_address(self): |
2540 | @@ -961,7 +961,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory): | |||
2541 | 961 | notifications = view.request.response.notifications | 961 | notifications = view.request.response.notifications |
2542 | 962 | self.assertEqual(1, len(notifications)) | 962 | self.assertEqual(1, len(notifications)) |
2543 | 963 | expected_msg = html_escape( | 963 | expected_msg = html_escape( |
2545 | 964 | u"The email address '%s' has been removed." % added_email) | 964 | "The email address '%s' has been removed." % added_email) |
2546 | 965 | self.assertEqual(expected_msg, notifications[0].message) | 965 | self.assertEqual(expected_msg, notifications[0].message) |
2547 | 966 | 966 | ||
2548 | 967 | def test_cannot_remove_contact_address(self): | 967 | def test_cannot_remove_contact_address(self): |
2549 | @@ -990,7 +990,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory): | |||
2550 | 990 | notifications = view.request.response.notifications | 990 | notifications = view.request.response.notifications |
2551 | 991 | self.assertEqual(1, len(notifications)) | 991 | self.assertEqual(1, len(notifications)) |
2552 | 992 | expected_msg = ( | 992 | expected_msg = ( |
2554 | 993 | u"Your contact address has been changed to: %s" % added_email) | 993 | "Your contact address has been changed to: %s" % added_email) |
2555 | 994 | self.assertEqual(expected_msg, notifications[0].message) | 994 | self.assertEqual(expected_msg, notifications[0].message) |
2556 | 995 | 995 | ||
2557 | 996 | def test_set_contact_address_already_set(self): | 996 | def test_set_contact_address_already_set(self): |
2558 | @@ -1022,21 +1022,21 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory): | |||
2559 | 1022 | def test_email_string_validation_no_email_prodvided(self): | 1022 | def test_email_string_validation_no_email_prodvided(self): |
2560 | 1023 | """+editemails should warn if no email is provided.""" | 1023 | """+editemails should warn if no email is provided.""" |
2561 | 1024 | no_email = '' | 1024 | no_email = '' |
2563 | 1025 | expected_msg = u'Required input is missing.' | 1025 | expected_msg = 'Required input is missing.' |
2564 | 1026 | self._assertEmailAndError(no_email, expected_msg) | 1026 | self._assertEmailAndError(no_email, expected_msg) |
2565 | 1027 | 1027 | ||
2566 | 1028 | def test_email_string_validation_invalid_email(self): | 1028 | def test_email_string_validation_invalid_email(self): |
2567 | 1029 | """+editemails should warn when provided data is not an email.""" | 1029 | """+editemails should warn when provided data is not an email.""" |
2568 | 1030 | not_an_email = 'foo' | 1030 | not_an_email = 'foo' |
2569 | 1031 | expected_msg = html_escape( | 1031 | expected_msg = html_escape( |
2571 | 1032 | u"'foo' doesn't seem to be a valid email address.") | 1032 | "'foo' doesn't seem to be a valid email address.") |
2572 | 1033 | self._assertEmailAndError(not_an_email, expected_msg) | 1033 | self._assertEmailAndError(not_an_email, expected_msg) |
2573 | 1034 | 1034 | ||
2574 | 1035 | def test_email_string_validation_is_escaped(self): | 1035 | def test_email_string_validation_is_escaped(self): |
2575 | 1036 | """+editemails should escape output to prevent XSS.""" | 1036 | """+editemails should escape output to prevent XSS.""" |
2576 | 1037 | xss_email = "foo@example.com<script>window.alert('XSS')</script>" | 1037 | xss_email = "foo@example.com<script>window.alert('XSS')</script>" |
2577 | 1038 | expected_msg = ( | 1038 | expected_msg = ( |
2579 | 1039 | u"'foo@example.com<script>" | 1039 | "'foo@example.com<script>" |
2580 | 1040 | "window.alert('XSS')</script>'" | 1040 | "window.alert('XSS')</script>'" |
2581 | 1041 | " doesn't seem to be a valid email address.") | 1041 | " doesn't seem to be a valid email address.") |
2582 | 1042 | self._assertEmailAndError(xss_email, expected_msg) | 1042 | self._assertEmailAndError(xss_email, expected_msg) |
2583 | @@ -1056,7 +1056,7 @@ class TestPersonParticipationView(TestCaseWithFactory): | |||
2584 | 1056 | layer = DatabaseFunctionalLayer | 1056 | layer = DatabaseFunctionalLayer |
2585 | 1057 | 1057 | ||
2586 | 1058 | def setUp(self): | 1058 | def setUp(self): |
2588 | 1059 | super(TestPersonParticipationView, self).setUp() | 1059 | super().setUp() |
2589 | 1060 | self.user = self.factory.makePerson() | 1060 | self.user = self.factory.makePerson() |
2590 | 1061 | self.view = create_view(self.user, name='+participation') | 1061 | self.view = create_view(self.user, name='+participation') |
2591 | 1062 | 1062 | ||
2592 | @@ -1234,7 +1234,7 @@ class TestPersonRelatedPackagesView(TestCaseWithFactory): | |||
2593 | 1234 | layer = LaunchpadFunctionalLayer | 1234 | layer = LaunchpadFunctionalLayer |
2594 | 1235 | 1235 | ||
2595 | 1236 | def setUp(self): | 1236 | def setUp(self): |
2597 | 1237 | super(TestPersonRelatedPackagesView, self).setUp() | 1237 | super().setUp() |
2598 | 1238 | self.user = self.factory.makePerson() | 1238 | self.user = self.factory.makePerson() |
2599 | 1239 | self.factory.makeGPGKey(self.user) | 1239 | self.factory.makeGPGKey(self.user) |
2600 | 1240 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu | 1240 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
2601 | @@ -1328,7 +1328,7 @@ class TestPersonMaintainedPackagesView(TestCaseWithFactory): | |||
2602 | 1328 | layer = DatabaseFunctionalLayer | 1328 | layer = DatabaseFunctionalLayer |
2603 | 1329 | 1329 | ||
2604 | 1330 | def setUp(self): | 1330 | def setUp(self): |
2606 | 1331 | super(TestPersonMaintainedPackagesView, self).setUp() | 1331 | super().setUp() |
2607 | 1332 | self.user = self.factory.makePerson() | 1332 | self.user = self.factory.makePerson() |
2608 | 1333 | self.view = create_initialized_view(self.user, '+maintained-packages') | 1333 | self.view = create_initialized_view(self.user, '+maintained-packages') |
2609 | 1334 | 1334 | ||
2610 | @@ -1347,7 +1347,7 @@ class TestPersonUploadedPackagesView(TestCaseWithFactory): | |||
2611 | 1347 | layer = DatabaseFunctionalLayer | 1347 | layer = DatabaseFunctionalLayer |
2612 | 1348 | 1348 | ||
2613 | 1349 | def setUp(self): | 1349 | def setUp(self): |
2615 | 1350 | super(TestPersonUploadedPackagesView, self).setUp() | 1350 | super().setUp() |
2616 | 1351 | self.user = self.factory.makePerson() | 1351 | self.user = self.factory.makePerson() |
2617 | 1352 | archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY) | 1352 | archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY) |
2618 | 1353 | spr = self.factory.makeSourcePackageRelease( | 1353 | spr = self.factory.makeSourcePackageRelease( |
2619 | @@ -1371,7 +1371,7 @@ class TestPersonPPAPackagesView(TestCaseWithFactory): | |||
2620 | 1371 | layer = DatabaseFunctionalLayer | 1371 | layer = DatabaseFunctionalLayer |
2621 | 1372 | 1372 | ||
2622 | 1373 | def setUp(self): | 1373 | def setUp(self): |
2624 | 1374 | super(TestPersonPPAPackagesView, self).setUp() | 1374 | super().setUp() |
2625 | 1375 | self.user = self.factory.makePerson() | 1375 | self.user = self.factory.makePerson() |
2626 | 1376 | self.view = create_initialized_view(self.user, '+ppa-packages') | 1376 | self.view = create_initialized_view(self.user, '+ppa-packages') |
2627 | 1377 | 1377 | ||
2628 | @@ -1432,7 +1432,7 @@ class TestPersonSynchronisedPackagesView(TestCaseWithFactory): | |||
2629 | 1432 | layer = DatabaseFunctionalLayer | 1432 | layer = DatabaseFunctionalLayer |
2630 | 1433 | 1433 | ||
2631 | 1434 | def setUp(self): | 1434 | def setUp(self): |
2633 | 1435 | super(TestPersonSynchronisedPackagesView, self).setUp() | 1435 | super().setUp() |
2634 | 1436 | user = self.factory.makePerson() | 1436 | user = self.factory.makePerson() |
2635 | 1437 | archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY) | 1437 | archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY) |
2636 | 1438 | spr = self.factory.makeSourcePackageRelease( | 1438 | spr = self.factory.makeSourcePackageRelease( |
2637 | @@ -1463,7 +1463,7 @@ class TestPersonRelatedProjectsView(TestCaseWithFactory): | |||
2638 | 1463 | layer = DatabaseFunctionalLayer | 1463 | layer = DatabaseFunctionalLayer |
2639 | 1464 | 1464 | ||
2640 | 1465 | def setUp(self): | 1465 | def setUp(self): |
2642 | 1466 | super(TestPersonRelatedProjectsView, self).setUp() | 1466 | super().setUp() |
2643 | 1467 | self.user = self.factory.makePerson() | 1467 | self.user = self.factory.makePerson() |
2644 | 1468 | 1468 | ||
2645 | 1469 | def test_view_helper_attributes(self): | 1469 | def test_view_helper_attributes(self): |
2646 | @@ -1498,7 +1498,7 @@ class TestPersonOCIRegistryCredentialsView( | |||
2647 | 1498 | ] | 1498 | ] |
2648 | 1499 | 1499 | ||
2649 | 1500 | def setUp(self): | 1500 | def setUp(self): |
2651 | 1501 | super(TestPersonOCIRegistryCredentialsView, self).setUp() | 1501 | super().setUp() |
2652 | 1502 | self.setConfig() | 1502 | self.setConfig() |
2653 | 1503 | if self.use_team: | 1503 | if self.use_team: |
2654 | 1504 | self.owner = self.factory.makeTeam(members=[self.user]) | 1504 | self.owner = self.factory.makeTeam(members=[self.user]) |
2655 | @@ -1721,7 +1721,7 @@ class TestPersonLiveFSView(BrowserTestCase): | |||
2656 | 1721 | layer = DatabaseFunctionalLayer | 1721 | layer = DatabaseFunctionalLayer |
2657 | 1722 | 1722 | ||
2658 | 1723 | def setUp(self): | 1723 | def setUp(self): |
2660 | 1724 | super(TestPersonLiveFSView, self).setUp() | 1724 | super().setUp() |
2661 | 1725 | self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) | 1725 | self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
2662 | 1726 | self.person = self.factory.makePerson( | 1726 | self.person = self.factory.makePerson( |
2663 | 1727 | name="test-person", displayname="Test Person") | 1727 | name="test-person", displayname="Test Person") |
2664 | @@ -1869,7 +1869,7 @@ class TestPersonRelatedPackagesFailedBuild(TestCaseWithFactory): | |||
2665 | 1869 | layer = LaunchpadFunctionalLayer | 1869 | layer = LaunchpadFunctionalLayer |
2666 | 1870 | 1870 | ||
2667 | 1871 | def setUp(self): | 1871 | def setUp(self): |
2669 | 1872 | super(TestPersonRelatedPackagesFailedBuild, self).setUp() | 1872 | super().setUp() |
2670 | 1873 | self.user = self.factory.makePerson() | 1873 | self.user = self.factory.makePerson() |
2671 | 1874 | 1874 | ||
2672 | 1875 | # First we need to publish some PPA packages with failed builds | 1875 | # First we need to publish some PPA packages with failed builds |
2673 | @@ -1923,7 +1923,7 @@ class TestPersonRelatedPackagesSynchronisedPackages(TestCaseWithFactory): | |||
2674 | 1923 | layer = LaunchpadFunctionalLayer | 1923 | layer = LaunchpadFunctionalLayer |
2675 | 1924 | 1924 | ||
2676 | 1925 | def setUp(self): | 1925 | def setUp(self): |
2678 | 1926 | super(TestPersonRelatedPackagesSynchronisedPackages, self).setUp() | 1926 | super().setUp() |
2679 | 1927 | self.user = self.factory.makePerson() | 1927 | self.user = self.factory.makePerson() |
2680 | 1928 | self.spph = self.factory.makeSourcePackagePublishingHistory() | 1928 | self.spph = self.factory.makeSourcePackagePublishingHistory() |
2681 | 1929 | 1929 | ||
2682 | @@ -2023,7 +2023,7 @@ class TestTeamInvitationView(TestCaseWithFactory): | |||
2683 | 2023 | layer = DatabaseFunctionalLayer | 2023 | layer = DatabaseFunctionalLayer |
2684 | 2024 | 2024 | ||
2685 | 2025 | def setUp(self): | 2025 | def setUp(self): |
2687 | 2026 | super(TestTeamInvitationView, self).setUp() | 2026 | super().setUp() |
2688 | 2027 | self.a_team = self.factory.makeTeam(name="team-a", | 2027 | self.a_team = self.factory.makeTeam(name="team-a", |
2689 | 2028 | displayname="A-Team") | 2028 | displayname="A-Team") |
2690 | 2029 | self.b_team = self.factory.makeTeam(name="team-b", | 2029 | self.b_team = self.factory.makeTeam(name="team-b", |
2691 | @@ -2046,7 +2046,7 @@ class TestTeamInvitationView(TestCaseWithFactory): | |||
2692 | 2046 | notifications = view.request.response.notifications | 2046 | notifications = view.request.response.notifications |
2693 | 2047 | self.assertEqual(1, len(notifications)) | 2047 | self.assertEqual(1, len(notifications)) |
2694 | 2048 | self.assertEqual( | 2048 | self.assertEqual( |
2696 | 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.', |
2697 | 2050 | notifications[0].message) | 2050 | notifications[0].message) |
2698 | 2051 | 2051 | ||
2699 | 2052 | # B invites A. | 2052 | # B invites A. |
2700 | @@ -2058,7 +2058,7 @@ class TestTeamInvitationView(TestCaseWithFactory): | |||
2701 | 2058 | notifications = view.request.response.notifications | 2058 | notifications = view.request.response.notifications |
2702 | 2059 | self.assertEqual(1, len(notifications)) | 2059 | self.assertEqual(1, len(notifications)) |
2703 | 2060 | self.assertEqual( | 2060 | self.assertEqual( |
2705 | 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.', |
2706 | 2062 | notifications[0].message) | 2062 | notifications[0].message) |
2707 | 2063 | 2063 | ||
2708 | 2064 | # Team A accepts the invitation. | 2064 | # Team A accepts the invitation. |
2709 | @@ -2078,7 +2078,7 @@ class TestTeamInvitationView(TestCaseWithFactory): | |||
2710 | 2078 | notifications = view.request.response.notifications | 2078 | notifications = view.request.response.notifications |
2711 | 2079 | self.assertEqual(1, len(notifications)) | 2079 | self.assertEqual(1, len(notifications)) |
2712 | 2080 | self.assertEqual( | 2080 | self.assertEqual( |
2714 | 2081 | u'This team is now a member of B-Team.', | 2081 | 'This team is now a member of B-Team.', |
2715 | 2082 | notifications[0].message) | 2082 | notifications[0].message) |
2716 | 2083 | 2083 | ||
2717 | 2084 | # Team B attempts to accept the invitation. | 2084 | # Team B attempts to accept the invitation. |
2718 | @@ -2093,7 +2093,7 @@ class TestTeamInvitationView(TestCaseWithFactory): | |||
2719 | 2093 | notifications = view.request.response.notifications | 2093 | notifications = view.request.response.notifications |
2720 | 2094 | self.assertEqual(1, len(notifications)) | 2094 | self.assertEqual(1, len(notifications)) |
2721 | 2095 | expected = ( | 2095 | expected = ( |
2723 | 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 ' |
2724 | 2097 | 'of B-Team.') | 2097 | 'of B-Team.') |
2725 | 2098 | self.assertEqual( | 2098 | self.assertEqual( |
2726 | 2099 | expected, | 2099 | expected, |
2727 | @@ -2105,8 +2105,7 @@ class TestSubscriptionsView(TestCaseWithFactory): | |||
2728 | 2105 | layer = LaunchpadFunctionalLayer | 2105 | layer = LaunchpadFunctionalLayer |
2729 | 2106 | 2106 | ||
2730 | 2107 | def setUp(self): | 2107 | def setUp(self): |
2733 | 2108 | super(TestSubscriptionsView, self).setUp( | 2108 | super().setUp(user='test@canonical.com') |
2732 | 2109 | user='test@canonical.com') | ||
2734 | 2110 | self.user = getUtility(ILaunchBag).user | 2109 | self.user = getUtility(ILaunchBag).user |
2735 | 2111 | self.person = self.factory.makePerson() | 2110 | self.person = self.factory.makePerson() |
2736 | 2112 | self.other_person = self.factory.makePerson() | 2111 | self.other_person = self.factory.makePerson() |
2737 | @@ -2135,7 +2134,7 @@ class BugTaskViewsTestBase: | |||
2738 | 2135 | layer = DatabaseFunctionalLayer | 2134 | layer = DatabaseFunctionalLayer |
2739 | 2136 | 2135 | ||
2740 | 2137 | def setUp(self): | 2136 | def setUp(self): |
2742 | 2138 | super(BugTaskViewsTestBase, self).setUp() | 2137 | super().setUp() |
2743 | 2139 | self.person = self.factory.makePerson() | 2138 | self.person = self.factory.makePerson() |
2744 | 2140 | with person_logged_in(self.person): | 2139 | with person_logged_in(self.person): |
2745 | 2141 | self.subscribed_bug = self.factory.makeBug() | 2140 | self.subscribed_bug = self.factory.makeBug() |
2746 | @@ -2189,7 +2188,7 @@ class TestPersonRelatedBugTaskSearchListingView( | |||
2747 | 2189 | view_name = '+bugs' | 2188 | view_name = '+bugs' |
2748 | 2190 | 2189 | ||
2749 | 2191 | def setUp(self): | 2190 | def setUp(self): |
2751 | 2192 | super(TestPersonRelatedBugTaskSearchListingView, self).setUp() | 2191 | super().setUp() |
2752 | 2193 | self.expected_for_search_unbatched = [ | 2192 | self.expected_for_search_unbatched = [ |
2753 | 2194 | self.subscribed_bug.default_bugtask, | 2193 | self.subscribed_bug.default_bugtask, |
2754 | 2195 | self.assigned_bug.default_bugtask, | 2194 | self.assigned_bug.default_bugtask, |
2755 | @@ -2205,7 +2204,7 @@ class TestPersonAssignedBugTaskSearchListingView( | |||
2756 | 2205 | view_name = '+assignedbugs' | 2204 | view_name = '+assignedbugs' |
2757 | 2206 | 2205 | ||
2758 | 2207 | def setUp(self): | 2206 | def setUp(self): |
2760 | 2208 | super(TestPersonAssignedBugTaskSearchListingView, self).setUp() | 2207 | super().setUp() |
2761 | 2209 | self.expected_for_search_unbatched = [ | 2208 | self.expected_for_search_unbatched = [ |
2762 | 2210 | self.assigned_bug.default_bugtask, | 2209 | self.assigned_bug.default_bugtask, |
2763 | 2211 | ] | 2210 | ] |
2764 | @@ -2218,7 +2217,7 @@ class TestPersonCommentedBugTaskSearchListingView( | |||
2765 | 2218 | view_name = '+commentedbugs' | 2217 | view_name = '+commentedbugs' |
2766 | 2219 | 2218 | ||
2767 | 2220 | def setUp(self): | 2219 | def setUp(self): |
2769 | 2221 | super(TestPersonCommentedBugTaskSearchListingView, self).setUp() | 2220 | super().setUp() |
2770 | 2222 | self.expected_for_search_unbatched = [ | 2221 | self.expected_for_search_unbatched = [ |
2771 | 2223 | self.commented_bug.default_bugtask, | 2222 | self.commented_bug.default_bugtask, |
2772 | 2224 | ] | 2223 | ] |
2773 | @@ -2231,7 +2230,7 @@ class TestPersonReportedBugTaskSearchListingView( | |||
2774 | 2231 | view_name = '+reportedbugs' | 2230 | view_name = '+reportedbugs' |
2775 | 2232 | 2231 | ||
2776 | 2233 | def setUp(self): | 2232 | def setUp(self): |
2778 | 2234 | super(TestPersonReportedBugTaskSearchListingView, self).setUp() | 2233 | super().setUp() |
2779 | 2235 | self.expected_for_search_unbatched = [ | 2234 | self.expected_for_search_unbatched = [ |
2780 | 2236 | self.owned_bug.default_bugtask, | 2235 | self.owned_bug.default_bugtask, |
2781 | 2237 | ] | 2236 | ] |
2782 | @@ -2244,7 +2243,7 @@ class TestPersonSubscribedBugTaskSearchListingView( | |||
2783 | 2244 | view_name = '+subscribedbugs' | 2243 | view_name = '+subscribedbugs' |
2784 | 2245 | 2244 | ||
2785 | 2246 | def setUp(self): | 2245 | def setUp(self): |
2787 | 2247 | super(TestPersonSubscribedBugTaskSearchListingView, self).setUp() | 2246 | super().setUp() |
2788 | 2248 | self.expected_for_search_unbatched = [ | 2247 | self.expected_for_search_unbatched = [ |
2789 | 2249 | self.subscribed_bug.default_bugtask, | 2248 | self.subscribed_bug.default_bugtask, |
2790 | 2250 | self.owned_bug.default_bugtask, | 2249 | self.owned_bug.default_bugtask, |
2791 | @@ -2258,7 +2257,7 @@ class TestPersonAffectingBugTaskSearchListingView( | |||
2792 | 2258 | view_name = '+affectingbugs' | 2257 | view_name = '+affectingbugs' |
2793 | 2259 | 2258 | ||
2794 | 2260 | def setUp(self): | 2259 | def setUp(self): |
2796 | 2261 | super(TestPersonAffectingBugTaskSearchListingView, self).setUp() | 2260 | super().setUp() |
2797 | 2262 | # Bugs filed by this user are marked as affecting them by default, so | 2261 | # Bugs filed by this user are marked as affecting them by default, so |
2798 | 2263 | # the bug we filed is returned. | 2262 | # the bug we filed is returned. |
2799 | 2264 | self.expected_for_search_unbatched = [ | 2263 | self.expected_for_search_unbatched = [ |
2800 | diff --git a/lib/lp/registry/browser/tests/test_person_contact.py b/lib/lp/registry/browser/tests/test_person_contact.py | |||
2801 | index 3696a64..4d26d16 100644 | |||
2802 | --- a/lib/lp/registry/browser/tests/test_person_contact.py | |||
2803 | +++ b/lib/lp/registry/browser/tests/test_person_contact.py | |||
2804 | @@ -424,7 +424,7 @@ class EmailToPersonViewTestCase(TestCaseWithFactory): | |||
2805 | 424 | with person_logged_in(sender): | 424 | with person_logged_in(sender): |
2806 | 425 | view = create_initialized_view(user, '+contactuser', form=form) | 425 | view = create_initialized_view(user, '+contactuser', form=form) |
2807 | 426 | self.assertEqual( | 426 | self.assertEqual( |
2809 | 427 | [u'You must provide a subject and a message.'], view.errors) | 427 | ['You must provide a subject and a message.'], view.errors) |
2810 | 428 | 428 | ||
2811 | 429 | def test_submitted_after_quota(self): | 429 | def test_submitted_after_quota(self): |
2812 | 430 | # The view explains when a message was not sent because the quota | 430 | # The view explains when a message was not sent because the quota |
2813 | diff --git a/lib/lp/registry/browser/tests/test_person_webservice.py b/lib/lp/registry/browser/tests/test_person_webservice.py | |||
2814 | index 2f5bc88..6d2ccdb 100644 | |||
2815 | --- a/lib/lp/registry/browser/tests/test_person_webservice.py | |||
2816 | +++ b/lib/lp/registry/browser/tests/test_person_webservice.py | |||
2817 | @@ -50,7 +50,7 @@ class TestPersonEmailSecurity(TestCaseWithFactory): | |||
2818 | 50 | layer = DatabaseFunctionalLayer | 50 | layer = DatabaseFunctionalLayer |
2819 | 51 | 51 | ||
2820 | 52 | def setUp(self): | 52 | def setUp(self): |
2822 | 53 | super(TestPersonEmailSecurity, self).setUp() | 53 | super().setUp() |
2823 | 54 | self.target = self.factory.makePerson(name='target') | 54 | self.target = self.factory.makePerson(name='target') |
2824 | 55 | self.email_one = self.factory.makeEmail( | 55 | self.email_one = self.factory.makeEmail( |
2825 | 56 | 'test1@example.com', self.target) | 56 | 'test1@example.com', self.target) |
2826 | @@ -87,7 +87,7 @@ class TestPersonAccountStatus(TestCaseWithFactory): | |||
2827 | 87 | person = self.factory.makePerson() | 87 | person = self.factory.makePerson() |
2828 | 88 | registrar = self.factory.makePerson( | 88 | registrar = self.factory.makePerson( |
2829 | 89 | member_of=[getUtility(IPersonSet).getByName('registry')]) | 89 | member_of=[getUtility(IPersonSet).getByName('registry')]) |
2831 | 90 | removeSecurityProxy(person.account).status_history = u'Test' | 90 | removeSecurityProxy(person.account).status_history = 'Test' |
2832 | 91 | person_url = api_url(person) | 91 | person_url = api_url(person) |
2833 | 92 | 92 | ||
2834 | 93 | # A normal user cannot read account_status_history. Not even | 93 | # A normal user cannot read account_status_history. Not even |
2835 | @@ -178,7 +178,7 @@ class PersonWebServiceTests(TestCaseWithFactory): | |||
2836 | 178 | team.addMember(person, owner) | 178 | team.addMember(person, owner) |
2837 | 179 | getUtility(ITeamMembershipSet).getByPersonAndTeam( | 179 | getUtility(ITeamMembershipSet).getByPersonAndTeam( |
2838 | 180 | person, team).setStatus( | 180 | person, team).setStatus( |
2840 | 181 | TeamMembershipStatus.DEACTIVATED, owner, u"Go away.") | 181 | TeamMembershipStatus.DEACTIVATED, owner, "Go away.") |
2841 | 182 | 182 | ||
2842 | 183 | def get_members(): | 183 | def get_members(): |
2843 | 184 | ws.get('/~%s/deactivated_members' % name).jsonBody() | 184 | ws.get('/~%s/deactivated_members' % name).jsonBody() |
2844 | @@ -250,7 +250,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory): | |||
2845 | 250 | layer = DatabaseFunctionalLayer | 250 | layer = DatabaseFunctionalLayer |
2846 | 251 | 251 | ||
2847 | 252 | def setUp(self): | 252 | def setUp(self): |
2849 | 253 | super(PersonSetWebServiceTests, self).setUp() | 253 | super().setUp() |
2850 | 254 | self.webservice = webservice_for_person(None) | 254 | self.webservice = webservice_for_person(None) |
2851 | 255 | 255 | ||
2852 | 256 | def assertReturnsPeople(self, expected_names, path): | 256 | def assertReturnsPeople(self, expected_names, path): |
2853 | @@ -309,7 +309,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory): | |||
2854 | 309 | def test_find_by_date(self): | 309 | def test_find_by_date(self): |
2855 | 310 | # Creation date filtering is supported. | 310 | # Creation date filtering is supported. |
2856 | 311 | self.assertReturnsPeople( | 311 | self.assertReturnsPeople( |
2858 | 312 | [u'bac'], | 312 | ['bac'], |
2859 | 313 | '/people?ws.op=findPerson&text=' | 313 | '/people?ws.op=findPerson&text=' |
2860 | 314 | '&created_after=2008-06-27&created_before=2008-07-01') | 314 | '&created_after=2008-06-27&created_before=2008-07-01') |
2861 | 315 | 315 | ||
2862 | @@ -401,7 +401,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory): | |||
2863 | 401 | account_status=AccountStatus.SUSPENDED) | 401 | account_status=AccountStatus.SUSPENDED) |
2864 | 402 | oid = OpenIdIdentifier() | 402 | oid = OpenIdIdentifier() |
2865 | 403 | oid.account = existing.account | 403 | oid.account = existing.account |
2867 | 404 | oid.identifier = u'somebody' | 404 | oid.identifier = 'somebody' |
2868 | 405 | Store.of(existing).add(oid) | 405 | Store.of(existing).add(oid) |
2869 | 406 | sca = getUtility(IPersonSet).getByName('software-center-agent') | 406 | sca = getUtility(IPersonSet).getByName('software-center-agent') |
2870 | 407 | response = self.getOrCreateSoftwareCenterCustomer(sca) | 407 | response = self.getOrCreateSoftwareCenterCustomer(sca) |
2871 | @@ -415,7 +415,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory): | |||
2872 | 415 | account_status=AccountStatus.DECEASED) | 415 | account_status=AccountStatus.DECEASED) |
2873 | 416 | oid = OpenIdIdentifier() | 416 | oid = OpenIdIdentifier() |
2874 | 417 | oid.account = existing.account | 417 | oid.account = existing.account |
2876 | 418 | oid.identifier = u'somebody' | 418 | oid.identifier = 'somebody' |
2877 | 419 | Store.of(existing).add(oid) | 419 | Store.of(existing).add(oid) |
2878 | 420 | sca = getUtility(IPersonSet).getByName('software-center-agent') | 420 | sca = getUtility(IPersonSet).getByName('software-center-agent') |
2879 | 421 | response = self.getOrCreateSoftwareCenterCustomer(sca) | 421 | response = self.getOrCreateSoftwareCenterCustomer(sca) |
2880 | @@ -468,7 +468,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory): | |||
2881 | 468 | with admin_logged_in(): | 468 | with admin_logged_in(): |
2882 | 469 | by_name = getUtility(IPersonSet).getByName('bar') | 469 | by_name = getUtility(IPersonSet).getByName('bar') |
2883 | 470 | by_openid = getUtility(IPersonSet).getByOpenIDIdentifier( | 470 | by_openid = getUtility(IPersonSet).getByOpenIDIdentifier( |
2885 | 471 | u'http://testopenid.test/+id/foo') | 471 | 'http://testopenid.test/+id/foo') |
2886 | 472 | self.assertEqual(by_name, by_openid) | 472 | self.assertEqual(by_name, by_openid) |
2887 | 473 | self.assertEqual( | 473 | self.assertEqual( |
2888 | 474 | AccountStatus.PLACEHOLDER, by_name.account_status) | 474 | AccountStatus.PLACEHOLDER, by_name.account_status) |
2889 | @@ -485,7 +485,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory): | |||
2890 | 485 | self.assertIs(None, getUtility(IPersonSet).getByName('bar')) | 485 | self.assertIs(None, getUtility(IPersonSet).getByName('bar')) |
2891 | 486 | self.assertRaises( | 486 | self.assertRaises( |
2892 | 487 | LookupError, | 487 | LookupError, |
2894 | 488 | getUtility(IAccountSet).getByOpenIDIdentifier, u'foo') | 488 | getUtility(IAccountSet).getByOpenIDIdentifier, 'foo') |
2895 | 489 | 489 | ||
2896 | 490 | def test_setUsernameFromSSO_is_restricted(self): | 490 | def test_setUsernameFromSSO_is_restricted(self): |
2897 | 491 | # The method may only be invoked by the ~ubuntu-sso celebrity | 491 | # The method may only be invoked by the ~ubuntu-sso celebrity |
2898 | diff --git a/lib/lp/registry/browser/tests/test_pillar_sharing.py b/lib/lp/registry/browser/tests/test_pillar_sharing.py | |||
2899 | index dbfd6b2..8ef5a25 100644 | |||
2900 | --- a/lib/lp/registry/browser/tests/test_pillar_sharing.py | |||
2901 | +++ b/lib/lp/registry/browser/tests/test_pillar_sharing.py | |||
2902 | @@ -63,7 +63,7 @@ class SharingBaseTestCase(TestCaseWithFactory): | |||
2903 | 63 | pillar_type = None | 63 | pillar_type = None |
2904 | 64 | 64 | ||
2905 | 65 | def setUp(self): | 65 | def setUp(self): |
2907 | 66 | super(SharingBaseTestCase, self).setUp() | 66 | super().setUp() |
2908 | 67 | self.driver = self.factory.makePerson() | 67 | self.driver = self.factory.makePerson() |
2909 | 68 | self.owner = self.factory.makePerson() | 68 | self.owner = self.factory.makePerson() |
2910 | 69 | if self.pillar_type == 'distribution': | 69 | if self.pillar_type == 'distribution': |
2911 | @@ -249,7 +249,7 @@ class TestProductSharingDetailsView( | |||
2912 | 249 | pillar_type = 'product' | 249 | pillar_type = 'product' |
2913 | 250 | 250 | ||
2914 | 251 | def setUp(self): | 251 | def setUp(self): |
2916 | 252 | super(TestProductSharingDetailsView, self).setUp() | 252 | super().setUp() |
2917 | 253 | login_person(self.owner) | 253 | login_person(self.owner) |
2918 | 254 | 254 | ||
2919 | 255 | 255 | ||
2920 | @@ -259,7 +259,7 @@ class TestDistributionSharingDetailsView( | |||
2921 | 259 | pillar_type = 'distribution' | 259 | pillar_type = 'distribution' |
2922 | 260 | 260 | ||
2923 | 261 | def setUp(self): | 261 | def setUp(self): |
2925 | 262 | super(TestDistributionSharingDetailsView, self).setUp() | 262 | super().setUp() |
2926 | 263 | login_person(self.owner) | 263 | login_person(self.owner) |
2927 | 264 | 264 | ||
2928 | 265 | 265 | ||
2929 | @@ -471,7 +471,7 @@ class TestProductSharingView(PillarSharingViewTestMixin, | |||
2930 | 471 | pillar_type = 'product' | 471 | pillar_type = 'product' |
2931 | 472 | 472 | ||
2932 | 473 | def setUp(self): | 473 | def setUp(self): |
2934 | 474 | super(TestProductSharingView, self).setUp() | 474 | super().setUp() |
2935 | 475 | self.setupSharing(self.grantees) | 475 | self.setupSharing(self.grantees) |
2936 | 476 | login_person(self.driver) | 476 | login_person(self.driver) |
2937 | 477 | # Use a FakeLogger fixture to prevent Memcached warnings to be | 477 | # Use a FakeLogger fixture to prevent Memcached warnings to be |
2938 | @@ -517,7 +517,7 @@ class TestDistributionSharingView(PillarSharingViewTestMixin, | |||
2939 | 517 | pillar_type = 'distribution' | 517 | pillar_type = 'distribution' |
2940 | 518 | 518 | ||
2941 | 519 | def setUp(self): | 519 | def setUp(self): |
2943 | 520 | super(TestDistributionSharingView, self).setUp() | 520 | super().setUp() |
2944 | 521 | self.setupSharing(self.grantees) | 521 | self.setupSharing(self.grantees) |
2945 | 522 | login_person(self.driver) | 522 | login_person(self.driver) |
2946 | 523 | 523 | ||
2947 | diff --git a/lib/lp/registry/browser/tests/test_poll.py b/lib/lp/registry/browser/tests/test_poll.py | |||
2948 | index 05f0183..b689df6 100644 | |||
2949 | --- a/lib/lp/registry/browser/tests/test_poll.py | |||
2950 | +++ b/lib/lp/registry/browser/tests/test_poll.py | |||
2951 | @@ -29,7 +29,7 @@ class TestPollVoteView(TestCaseWithFactory): | |||
2952 | 29 | layer = DatabaseFunctionalLayer | 29 | layer = DatabaseFunctionalLayer |
2953 | 30 | 30 | ||
2954 | 31 | def setUp(self): | 31 | def setUp(self): |
2956 | 32 | super(TestPollVoteView, self).setUp() | 32 | super().setUp() |
2957 | 33 | self.team = self.factory.makeTeam() | 33 | self.team = self.factory.makeTeam() |
2958 | 34 | 34 | ||
2959 | 35 | def test_simple_poll_template(self): | 35 | def test_simple_poll_template(self): |
2960 | @@ -55,7 +55,7 @@ class TestPollAddView(BrowserTestCase): | |||
2961 | 55 | layer = DatabaseFunctionalLayer | 55 | layer = DatabaseFunctionalLayer |
2962 | 56 | 56 | ||
2963 | 57 | def setUp(self): | 57 | def setUp(self): |
2965 | 58 | super(TestPollAddView, self).setUp() | 58 | super().setUp() |
2966 | 59 | self.pushConfig( | 59 | self.pushConfig( |
2967 | 60 | "launchpad", min_legitimate_karma=5, min_legitimate_account_age=5) | 60 | "launchpad", min_legitimate_karma=5, min_legitimate_account_age=5) |
2968 | 61 | 61 | ||
2969 | diff --git a/lib/lp/registry/browser/tests/test_product.py b/lib/lp/registry/browser/tests/test_product.py | |||
2970 | index 1f571fe..c79cbd1 100644 | |||
2971 | --- a/lib/lp/registry/browser/tests/test_product.py | |||
2972 | +++ b/lib/lp/registry/browser/tests/test_product.py | |||
2973 | @@ -206,7 +206,7 @@ class TestProductConfiguration(BrowserTestCase): | |||
2974 | 206 | layer = DatabaseFunctionalLayer | 206 | layer = DatabaseFunctionalLayer |
2975 | 207 | 207 | ||
2976 | 208 | def setUp(self): | 208 | def setUp(self): |
2978 | 209 | super(TestProductConfiguration, self).setUp() | 209 | super().setUp() |
2979 | 210 | self.product = self.factory.makeProduct() | 210 | self.product = self.factory.makeProduct() |
2980 | 211 | 211 | ||
2981 | 212 | def test_registration_not_done(self): | 212 | def test_registration_not_done(self): |
2982 | @@ -295,7 +295,7 @@ class TestProductAddView(TestCaseWithFactory): | |||
2983 | 295 | layer = DatabaseFunctionalLayer | 295 | layer = DatabaseFunctionalLayer |
2984 | 296 | 296 | ||
2985 | 297 | def setUp(self): | 297 | def setUp(self): |
2987 | 298 | super(TestProductAddView, self).setUp() | 298 | super().setUp() |
2988 | 299 | self.product_set = getUtility(IProductSet) | 299 | self.product_set = getUtility(IProductSet) |
2989 | 300 | 300 | ||
2990 | 301 | def test_view_data_model(self): | 301 | def test_view_data_model(self): |
2991 | @@ -424,7 +424,7 @@ class TestProductView(BrowserTestCase): | |||
2992 | 424 | layer = DatabaseFunctionalLayer | 424 | layer = DatabaseFunctionalLayer |
2993 | 425 | 425 | ||
2994 | 426 | def setUp(self): | 426 | def setUp(self): |
2996 | 427 | super(TestProductView, self).setUp() | 427 | super().setUp() |
2997 | 428 | self.product = self.factory.makeProduct(name='fnord') | 428 | self.product = self.factory.makeProduct(name='fnord') |
2998 | 429 | self.tag_meta_noindex = Tag( | 429 | self.tag_meta_noindex = Tag( |
2999 | 430 | 'meta_noindex', 'meta', attrs={ | 430 | 'meta_noindex', 'meta', attrs={ |
3000 | @@ -741,7 +741,7 @@ class TestProductEditView(BrowserTestCase): | |||
3001 | 741 | layer = DatabaseFunctionalLayer | 741 | layer = DatabaseFunctionalLayer |
3002 | 742 | 742 | ||
3003 | 743 | def setUp(self): | 743 | def setUp(self): |
3005 | 744 | super(TestProductEditView, self).setUp() | 744 | super().setUp() |
3006 | 745 | 745 | ||
3007 | 746 | def _make_product_edit_form(self, product, proprietary=False): | 746 | def _make_product_edit_form(self, product, proprietary=False): |
3008 | 747 | """Return form data for product edit. | 747 | """Return form data for product edit. |
3009 | @@ -927,7 +927,7 @@ class ProductSetReviewLicensesViewTestCase(TestCaseWithFactory): | |||
3010 | 927 | layer = LaunchpadFunctionalLayer | 927 | layer = LaunchpadFunctionalLayer |
3011 | 928 | 928 | ||
3012 | 929 | def setUp(self): | 929 | def setUp(self): |
3014 | 930 | super(ProductSetReviewLicensesViewTestCase, self).setUp() | 930 | super().setUp() |
3015 | 931 | self.product_set = getUtility(IProductSet) | 931 | self.product_set = getUtility(IProductSet) |
3016 | 932 | self.user = login_celebrity('registry_experts') | 932 | self.user = login_celebrity('registry_experts') |
3017 | 933 | 933 | ||
3018 | diff --git a/lib/lp/registry/browser/tests/test_projectgroup.py b/lib/lp/registry/browser/tests/test_projectgroup.py | |||
3019 | index 75c9d9f..a76ae7d 100644 | |||
3020 | --- a/lib/lp/registry/browser/tests/test_projectgroup.py | |||
3021 | +++ b/lib/lp/registry/browser/tests/test_projectgroup.py | |||
3022 | @@ -39,7 +39,7 @@ class TestProjectGroupView(BrowserTestCase): | |||
3023 | 39 | layer = DatabaseFunctionalLayer | 39 | layer = DatabaseFunctionalLayer |
3024 | 40 | 40 | ||
3025 | 41 | def setUp(self): | 41 | def setUp(self): |
3027 | 42 | super(TestProjectGroupView, self).setUp() | 42 | super().setUp() |
3028 | 43 | self.project_group = self.factory.makeProject(name='group') | 43 | self.project_group = self.factory.makeProject(name='group') |
3029 | 44 | 44 | ||
3030 | 45 | def test_view_data_model(self): | 45 | def test_view_data_model(self): |
3031 | @@ -136,7 +136,7 @@ class TestProjectGroupEditView(TestCaseWithFactory): | |||
3032 | 136 | layer = DatabaseFunctionalLayer | 136 | layer = DatabaseFunctionalLayer |
3033 | 137 | 137 | ||
3034 | 138 | def setUp(self): | 138 | def setUp(self): |
3036 | 139 | super(TestProjectGroupEditView, self).setUp() | 139 | super().setUp() |
3037 | 140 | self.project_group = self.factory.makeProject(name='group') | 140 | self.project_group = self.factory.makeProject(name='group') |
3038 | 141 | # Use a FakeLogger fixture to prevent Memcached warnings to be | 141 | # Use a FakeLogger fixture to prevent Memcached warnings to be |
3039 | 142 | # printed to stdout while browsing pages. | 142 | # printed to stdout while browsing pages. |
3040 | diff --git a/lib/lp/registry/browser/tests/test_reassign_team_view.py b/lib/lp/registry/browser/tests/test_reassign_team_view.py | |||
3041 | index c5cba77..cad98ce 100644 | |||
3042 | --- a/lib/lp/registry/browser/tests/test_reassign_team_view.py | |||
3043 | +++ b/lib/lp/registry/browser/tests/test_reassign_team_view.py | |||
3044 | @@ -153,7 +153,7 @@ class TestTeamReassignmentViewErrors(TestCaseWithFactory): | |||
3045 | 153 | a_team, '+reassign', form=form, principal=owner) | 153 | a_team, '+reassign', form=form, principal=owner) |
3046 | 154 | self.assertEqual( | 154 | self.assertEqual( |
3047 | 155 | [html_escape( | 155 | [html_escape( |
3049 | 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 " |
3050 | 157 | "Launchpad. Please choose a different name or select the " | 157 | "Launchpad. Please choose a different name or select the " |
3051 | 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 " |
3052 | 159 | "what you want.")], | 159 | "what you want.")], |
3053 | diff --git a/lib/lp/registry/browser/tests/test_sourcepackage_views.py b/lib/lp/registry/browser/tests/test_sourcepackage_views.py | |||
3054 | index eb5ccd3..dcb66d0 100644 | |||
3055 | --- a/lib/lp/registry/browser/tests/test_sourcepackage_views.py | |||
3056 | +++ b/lib/lp/registry/browser/tests/test_sourcepackage_views.py | |||
3057 | @@ -221,7 +221,7 @@ class TestSourcePackageUpstreamConnectionsView(TestCaseWithFactory): | |||
3058 | 221 | layer = DatabaseFunctionalLayer | 221 | layer = DatabaseFunctionalLayer |
3059 | 222 | 222 | ||
3060 | 223 | def setUp(self): | 223 | def setUp(self): |
3062 | 224 | super(TestSourcePackageUpstreamConnectionsView, self).setUp() | 224 | super().setUp() |
3063 | 225 | productseries = self.factory.makeProductSeries(name='1.0') | 225 | productseries = self.factory.makeProductSeries(name='1.0') |
3064 | 226 | self.milestone = self.factory.makeMilestone( | 226 | self.milestone = self.factory.makeMilestone( |
3065 | 227 | product=productseries.product, productseries=productseries) | 227 | product=productseries.product, productseries=productseries) |
3066 | diff --git a/lib/lp/registry/browser/tests/test_subscription_links.py b/lib/lp/registry/browser/tests/test_subscription_links.py | |||
3067 | index 0c820b8..886e078 100644 | |||
3068 | --- a/lib/lp/registry/browser/tests/test_subscription_links.py | |||
3069 | +++ b/lib/lp/registry/browser/tests/test_subscription_links.py | |||
3070 | @@ -85,7 +85,7 @@ class _TestStructSubs(TestCaseWithFactory, _TestResultsMixin): | |||
3071 | 85 | layer = DatabaseFunctionalLayer | 85 | layer = DatabaseFunctionalLayer |
3072 | 86 | 86 | ||
3073 | 87 | def setUp(self): | 87 | def setUp(self): |
3075 | 88 | super(_TestStructSubs, self).setUp() | 88 | super().setUp() |
3076 | 89 | self.regular_user = self.factory.makePerson() | 89 | self.regular_user = self.factory.makePerson() |
3077 | 90 | # Use a FakeLogger fixture to prevent Memcached warnings to be | 90 | # Use a FakeLogger fixture to prevent Memcached warnings to be |
3078 | 91 | # printed to stdout while browsing pages. | 91 | # printed to stdout while browsing pages. |
3079 | @@ -123,7 +123,7 @@ class ProductView(_TestStructSubs): | |||
3080 | 123 | view = '+index' | 123 | view = '+index' |
3081 | 124 | 124 | ||
3082 | 125 | def setUp(self): | 125 | def setUp(self): |
3084 | 126 | super(ProductView, self).setUp() | 126 | super().setUp() |
3085 | 127 | self.target = self.factory.makeProduct(official_malone=True) | 127 | self.target = self.factory.makeProduct(official_malone=True) |
3086 | 128 | 128 | ||
3087 | 129 | 129 | ||
3088 | @@ -141,7 +141,7 @@ class ProjectGroupView(_TestStructSubs): | |||
3089 | 141 | view = '+index' | 141 | view = '+index' |
3090 | 142 | 142 | ||
3091 | 143 | def setUp(self): | 143 | def setUp(self): |
3093 | 144 | super(ProjectGroupView, self).setUp() | 144 | super().setUp() |
3094 | 145 | self.target = self.factory.makeProject() | 145 | self.target = self.factory.makeProject() |
3095 | 146 | self.factory.makeProduct( | 146 | self.factory.makeProduct( |
3096 | 147 | projectgroup=self.target, official_malone=True) | 147 | projectgroup=self.target, official_malone=True) |
3097 | @@ -183,7 +183,7 @@ class ProductSeriesView(_TestStructSubs): | |||
3098 | 183 | view = '+index' | 183 | view = '+index' |
3099 | 184 | 184 | ||
3100 | 185 | def setUp(self): | 185 | def setUp(self): |
3102 | 186 | super(ProductSeriesView, self).setUp() | 186 | super().setUp() |
3103 | 187 | product = self.factory.makeProduct(official_malone=True) | 187 | product = self.factory.makeProduct(official_malone=True) |
3104 | 188 | self.target = self.factory.makeProductSeries(product=product) | 188 | self.target = self.factory.makeProductSeries(product=product) |
3105 | 189 | 189 | ||
3106 | @@ -195,7 +195,7 @@ class ProductSeriesBugs(ProductSeriesView): | |||
3107 | 195 | view = '+bugs' | 195 | view = '+bugs' |
3108 | 196 | 196 | ||
3109 | 197 | def setUp(self): | 197 | def setUp(self): |
3111 | 198 | super(ProductSeriesBugs, self).setUp() | 198 | super().setUp() |
3112 | 199 | with person_logged_in(self.target.product.owner): | 199 | with person_logged_in(self.target.product.owner): |
3113 | 200 | self.target.product.official_malone = True | 200 | self.target.product.official_malone = True |
3114 | 201 | 201 | ||
3115 | @@ -207,7 +207,7 @@ class DistributionSourcePackageView(_TestStructSubs): | |||
3116 | 207 | view = '+index' | 207 | view = '+index' |
3117 | 208 | 208 | ||
3118 | 209 | def setUp(self): | 209 | def setUp(self): |
3120 | 210 | super(DistributionSourcePackageView, self).setUp() | 210 | super().setUp() |
3121 | 211 | distro = self.factory.makeDistribution() | 211 | distro = self.factory.makeDistribution() |
3122 | 212 | with person_logged_in(distro.owner): | 212 | with person_logged_in(distro.owner): |
3123 | 213 | distro.official_malone = True | 213 | distro.official_malone = True |
3124 | @@ -242,7 +242,7 @@ class DistroView(BrowserTestCase, _TestResultsMixin): | |||
3125 | 242 | view = '+index' | 242 | view = '+index' |
3126 | 243 | 243 | ||
3127 | 244 | def setUp(self): | 244 | def setUp(self): |
3129 | 245 | super(DistroView, self).setUp() | 245 | super().setUp() |
3130 | 246 | self.target = self.factory.makeDistribution() | 246 | self.target = self.factory.makeDistribution() |
3131 | 247 | with person_logged_in(self.target.owner): | 247 | with person_logged_in(self.target.owner): |
3132 | 248 | self.target.official_malone = True | 248 | self.target.official_malone = True |
3133 | @@ -341,7 +341,7 @@ class DistroMilestoneView(DistroView): | |||
3134 | 341 | """Test structural subscriptions on the distro milestones.""" | 341 | """Test structural subscriptions on the distro milestones.""" |
3135 | 342 | 342 | ||
3136 | 343 | def setUp(self): | 343 | def setUp(self): |
3138 | 344 | super(DistroMilestoneView, self).setUp() | 344 | super().setUp() |
3139 | 345 | self.distro = self.target | 345 | self.distro = self.target |
3140 | 346 | self.target = self.factory.makeMilestone(distribution=self.distro) | 346 | self.target = self.factory.makeMilestone(distribution=self.distro) |
3141 | 347 | 347 | ||
3142 | @@ -380,7 +380,7 @@ class ProductMilestoneView(DistroView): | |||
3143 | 380 | """Test structural subscriptions on the product milestones.""" | 380 | """Test structural subscriptions on the product milestones.""" |
3144 | 381 | 381 | ||
3145 | 382 | def setUp(self): | 382 | def setUp(self): |
3147 | 383 | super(ProductMilestoneView, self).setUp() | 383 | super().setUp() |
3148 | 384 | self.product = self.factory.makeProduct() | 384 | self.product = self.factory.makeProduct() |
3149 | 385 | with person_logged_in(self.product.owner): | 385 | with person_logged_in(self.product.owner): |
3150 | 386 | self.product.official_malone = True | 386 | self.product.official_malone = True |
3151 | @@ -411,7 +411,7 @@ class ProductSeriesMilestoneView(ProductMilestoneView): | |||
3152 | 411 | """Test structural subscriptions on the product series milestones.""" | 411 | """Test structural subscriptions on the product series milestones.""" |
3153 | 412 | 412 | ||
3154 | 413 | def setUp(self): | 413 | def setUp(self): |
3156 | 414 | super(ProductSeriesMilestoneView, self).setUp() | 414 | super().setUp() |
3157 | 415 | self.productseries = self.factory.makeProductSeries() | 415 | self.productseries = self.factory.makeProductSeries() |
3158 | 416 | with person_logged_in(self.productseries.product.owner): | 416 | with person_logged_in(self.productseries.product.owner): |
3159 | 417 | self.productseries.product.official_malone = True | 417 | self.productseries.product.official_malone = True |
3160 | @@ -426,7 +426,7 @@ class _DoesNotUseLP(ProductView): | |||
3161 | 426 | """Test structural subscriptions on the product view.""" | 426 | """Test structural subscriptions on the product view.""" |
3162 | 427 | 427 | ||
3163 | 428 | def setUp(self): | 428 | def setUp(self): |
3165 | 429 | super(_DoesNotUseLP, self).setUp() | 429 | super().setUp() |
3166 | 430 | self.target = self.factory.makeProduct(official_malone=False) | 430 | self.target = self.factory.makeProduct(official_malone=False) |
3167 | 431 | 431 | ||
3168 | 432 | def test_subscribe_link_owner(self): | 432 | def test_subscribe_link_owner(self): |
3169 | @@ -472,7 +472,7 @@ class ProjectGroupDoesNotUseLPView(_DoesNotUseLP): | |||
3170 | 472 | view = '+index' | 472 | view = '+index' |
3171 | 473 | 473 | ||
3172 | 474 | def setUp(self): | 474 | def setUp(self): |
3174 | 475 | super(ProjectGroupDoesNotUseLPView, self).setUp() | 475 | super().setUp() |
3175 | 476 | self.target = self.factory.makeProject() | 476 | self.target = self.factory.makeProject() |
3176 | 477 | self.factory.makeProduct( | 477 | self.factory.makeProduct( |
3177 | 478 | projectgroup=self.target, official_malone=False) | 478 | projectgroup=self.target, official_malone=False) |
3178 | @@ -485,7 +485,7 @@ class ProjectGroupDoesNotUseLPBugs(ProductDoesNotUseLPBugs): | |||
3179 | 485 | view = '+bugs' | 485 | view = '+bugs' |
3180 | 486 | 486 | ||
3181 | 487 | def setUp(self): | 487 | def setUp(self): |
3183 | 488 | super(ProjectGroupDoesNotUseLPBugs, self).setUp() | 488 | super().setUp() |
3184 | 489 | self.target = self.factory.makeProject() | 489 | self.target = self.factory.makeProject() |
3185 | 490 | self.factory.makeProduct( | 490 | self.factory.makeProduct( |
3186 | 491 | projectgroup=self.target, official_malone=False) | 491 | projectgroup=self.target, official_malone=False) |
3187 | @@ -496,7 +496,7 @@ class ProjectGroupDoesNotUseLPBugs(ProductDoesNotUseLPBugs): | |||
3188 | 496 | class ProductSeriesDoesNotUseLPView(_DoesNotUseLP): | 496 | class ProductSeriesDoesNotUseLPView(_DoesNotUseLP): |
3189 | 497 | 497 | ||
3190 | 498 | def setUp(self): | 498 | def setUp(self): |
3192 | 499 | super(ProductSeriesDoesNotUseLPView, self).setUp() | 499 | super().setUp() |
3193 | 500 | product = self.factory.makeProduct(official_malone=False) | 500 | product = self.factory.makeProduct(official_malone=False) |
3194 | 501 | self.target = self.factory.makeProductSeries(product=product) | 501 | self.target = self.factory.makeProductSeries(product=product) |
3195 | 502 | 502 | ||
3196 | @@ -504,7 +504,7 @@ class ProductSeriesDoesNotUseLPView(_DoesNotUseLP): | |||
3197 | 504 | class ProductSeriesDoesNotUseLPBugs(_DoesNotUseLP): | 504 | class ProductSeriesDoesNotUseLPBugs(_DoesNotUseLP): |
3198 | 505 | 505 | ||
3199 | 506 | def setUp(self): | 506 | def setUp(self): |
3201 | 507 | super(ProductSeriesDoesNotUseLPBugs, self).setUp() | 507 | super().setUp() |
3202 | 508 | product = self.factory.makeProduct(official_malone=False) | 508 | product = self.factory.makeProduct(official_malone=False) |
3203 | 509 | self.target = self.factory.makeProductSeries(product=product) | 509 | self.target = self.factory.makeProductSeries(product=product) |
3204 | 510 | 510 | ||
3205 | @@ -513,7 +513,7 @@ class DistributionSourcePackageDoesNotUseLPView(_DoesNotUseLP): | |||
3206 | 513 | """Test structural subscriptions on the distro src pkg view.""" | 513 | """Test structural subscriptions on the distro src pkg view.""" |
3207 | 514 | 514 | ||
3208 | 515 | def setUp(self): | 515 | def setUp(self): |
3210 | 516 | super(DistributionSourcePackageDoesNotUseLPView, self).setUp() | 516 | super().setUp() |
3211 | 517 | distro = self.factory.makeDistribution() | 517 | distro = self.factory.makeDistribution() |
3212 | 518 | self.target = self.factory.makeDistributionSourcePackage( | 518 | self.target = self.factory.makeDistributionSourcePackage( |
3213 | 519 | distribution=distro) | 519 | distribution=distro) |
3214 | @@ -535,7 +535,7 @@ class DistributionSourcePackageDoesNotUseLPBugs(ProductDoesNotUseLPBugs): | |||
3215 | 535 | class DistroDoesNotUseLPView(DistroView): | 535 | class DistroDoesNotUseLPView(DistroView): |
3216 | 536 | 536 | ||
3217 | 537 | def setUp(self): | 537 | def setUp(self): |
3219 | 538 | super(DistroDoesNotUseLPView, self).setUp() | 538 | super().setUp() |
3220 | 539 | self.target = self.factory.makeDistribution() | 539 | self.target = self.factory.makeDistribution() |
3221 | 540 | self.regular_user = self.factory.makePerson() | 540 | self.regular_user = self.factory.makePerson() |
3222 | 541 | 541 | ||
3223 | @@ -577,7 +577,7 @@ class DistroDoesNotUseLPBugs(DistroDoesNotUseLPView): | |||
3224 | 577 | class DistroMilestoneDoesNotUseLPView(DistroMilestoneView): | 577 | class DistroMilestoneDoesNotUseLPView(DistroMilestoneView): |
3225 | 578 | 578 | ||
3226 | 579 | def setUp(self): | 579 | def setUp(self): |
3228 | 580 | super(DistroMilestoneDoesNotUseLPView, self).setUp() | 580 | super().setUp() |
3229 | 581 | with person_logged_in(self.distro.owner): | 581 | with person_logged_in(self.distro.owner): |
3230 | 582 | self.distro.official_malone = False | 582 | self.distro.official_malone = False |
3231 | 583 | 583 | ||
3232 | @@ -620,7 +620,7 @@ class DistroMilestoneDoesNotUseLPView(DistroMilestoneView): | |||
3233 | 620 | class ProductMilestoneDoesNotUseLPView(ProductMilestoneView): | 620 | class ProductMilestoneDoesNotUseLPView(ProductMilestoneView): |
3234 | 621 | 621 | ||
3235 | 622 | def setUp(self): | 622 | def setUp(self): |
3237 | 623 | super(ProductMilestoneDoesNotUseLPView, self).setUp() | 623 | super().setUp() |
3238 | 624 | self.product = self.factory.makeProduct() | 624 | self.product = self.factory.makeProduct() |
3239 | 625 | with person_logged_in(self.product.owner): | 625 | with person_logged_in(self.product.owner): |
3240 | 626 | self.product.official_malone = False | 626 | self.product.official_malone = False |
3241 | @@ -648,8 +648,7 @@ class CustomTestLoader(unittest.TestLoader): | |||
3242 | 648 | if testCaseClass is _TestStructSubs: | 648 | if testCaseClass is _TestStructSubs: |
3243 | 649 | return [] | 649 | return [] |
3244 | 650 | else: | 650 | else: |
3247 | 651 | return super(CustomTestLoader, self).getTestCaseNames( | 651 | return super().getTestCaseNames(testCaseClass) |
3246 | 652 | testCaseClass) | ||
3248 | 653 | 652 | ||
3249 | 654 | 653 | ||
3250 | 655 | def test_suite(): | 654 | def test_suite(): |
3251 | diff --git a/lib/lp/registry/browser/tests/test_team.py b/lib/lp/registry/browser/tests/test_team.py | |||
3252 | index 5a3f781..fb02cb2 100644 | |||
3253 | --- a/lib/lp/registry/browser/tests/test_team.py | |||
3254 | +++ b/lib/lp/registry/browser/tests/test_team.py | |||
3255 | @@ -70,7 +70,7 @@ class TestProposedTeamMembersEditView(TestCaseWithFactory): | |||
3256 | 70 | layer = DatabaseFunctionalLayer | 70 | layer = DatabaseFunctionalLayer |
3257 | 71 | 71 | ||
3258 | 72 | def setUp(self): | 72 | def setUp(self): |
3260 | 73 | super(TestProposedTeamMembersEditView, self).setUp() | 73 | super().setUp() |
3261 | 74 | self.owner = self.factory.makePerson(name="team-owner") | 74 | self.owner = self.factory.makePerson(name="team-owner") |
3262 | 75 | self.a_team = self.makeTeam("team-a", "A-Team") | 75 | self.a_team = self.makeTeam("team-a", "A-Team") |
3263 | 76 | self.b_team = self.makeTeam("team-b", "B-Team") | 76 | self.b_team = self.makeTeam("team-b", "B-Team") |
3264 | @@ -97,7 +97,7 @@ class TestProposedTeamMembersEditView(TestCaseWithFactory): | |||
3265 | 97 | self.assertEqual([], view.errors) | 97 | self.assertEqual([], view.errors) |
3266 | 98 | notifications = view.request.response.notifications | 98 | notifications = view.request.response.notifications |
3267 | 99 | self.assertEqual(1, len(notifications)) | 99 | self.assertEqual(1, len(notifications)) |
3269 | 100 | expected = u"%s has been proposed to this team." % ( | 100 | expected = "%s has been proposed to this team." % ( |
3270 | 101 | joiner.displayname) | 101 | joiner.displayname) |
3271 | 102 | self.assertEqual( | 102 | self.assertEqual( |
3272 | 103 | expected, | 103 | expected, |
3273 | @@ -112,13 +112,13 @@ class TestProposedTeamMembersEditView(TestCaseWithFactory): | |||
3274 | 112 | failed_names = ', '.join([team.displayname for team in failed]) | 112 | failed_names = ', '.join([team.displayname for team in failed]) |
3275 | 113 | if len(failed) == 1: | 113 | if len(failed) == 1: |
3276 | 114 | failed_message = html_escape( | 114 | failed_message = html_escape( |
3278 | 115 | u'%s is a member of the following team, ' | 115 | '%s is a member of the following team, ' |
3279 | 116 | 'so it could not be accepted: %s. ' | 116 | 'so it could not be accepted: %s. ' |
3280 | 117 | 'You need to "Decline" that team.' % | 117 | 'You need to "Decline" that team.' % |
3281 | 118 | (joinee.displayname, failed_names)) | 118 | (joinee.displayname, failed_names)) |
3282 | 119 | else: | 119 | else: |
3283 | 120 | failed_message = html_escape( | 120 | failed_message = html_escape( |
3285 | 121 | u'%s is a member of the following teams, ' | 121 | '%s is a member of the following teams, ' |
3286 | 122 | 'so they could not be accepted: %s. ' | 122 | 'so they could not be accepted: %s. ' |
3287 | 123 | 'You need to "Decline" those teams.' % | 123 | 'You need to "Decline" those teams.' % |
3288 | 124 | (joinee.displayname, failed_names)) | 124 | (joinee.displayname, failed_names)) |
3289 | @@ -605,7 +605,7 @@ class TestTeamMenu(TestCaseWithFactory): | |||
3290 | 605 | layer = DatabaseFunctionalLayer | 605 | layer = DatabaseFunctionalLayer |
3291 | 606 | 606 | ||
3292 | 607 | def setUp(self): | 607 | def setUp(self): |
3294 | 608 | super(TestTeamMenu, self).setUp() | 608 | super().setUp() |
3295 | 609 | self.team = self.factory.makeTeam() | 609 | self.team = self.factory.makeTeam() |
3296 | 610 | 610 | ||
3297 | 611 | def test_TeamIndexMenu(self): | 611 | def test_TeamIndexMenu(self): |
3298 | @@ -754,7 +754,7 @@ class TestTeamMemberAddView(TestCaseWithFactory): | |||
3299 | 754 | layer = DatabaseFunctionalLayer | 754 | layer = DatabaseFunctionalLayer |
3300 | 755 | 755 | ||
3301 | 756 | def setUp(self): | 756 | def setUp(self): |
3303 | 757 | super(TestTeamMemberAddView, self).setUp() | 757 | super().setUp() |
3304 | 758 | self.team = self.factory.makeTeam(name='test-team') | 758 | self.team = self.factory.makeTeam(name='test-team') |
3305 | 759 | login_person(self.team.teamowner) | 759 | login_person(self.team.teamowner) |
3306 | 760 | 760 | ||
3307 | @@ -844,7 +844,7 @@ class TeamMembershipViewTestCase(TestCaseWithFactory): | |||
3308 | 844 | team = self.factory.makeTeam(name='pting') | 844 | team = self.factory.makeTeam(name='pting') |
3309 | 845 | view = create_initialized_view(team, name='+members') | 845 | view = create_initialized_view(team, name='+members') |
3310 | 846 | self.assertEqual('Members', view.page_title) | 846 | self.assertEqual('Members', view.page_title) |
3312 | 847 | self.assertEqual(u'Members of \u201cPting\u201d', view.label) | 847 | self.assertEqual('Members of \u201cPting\u201d', view.label) |
3313 | 848 | 848 | ||
3314 | 849 | 849 | ||
3315 | 850 | class TestTeamIndexView(TestCaseWithFactory): | 850 | class TestTeamIndexView(TestCaseWithFactory): |
3316 | @@ -852,7 +852,7 @@ class TestTeamIndexView(TestCaseWithFactory): | |||
3317 | 852 | layer = DatabaseFunctionalLayer | 852 | layer = DatabaseFunctionalLayer |
3318 | 853 | 853 | ||
3319 | 854 | def setUp(self): | 854 | def setUp(self): |
3321 | 855 | super(TestTeamIndexView, self).setUp() | 855 | super().setUp() |
3322 | 856 | self.team = self.factory.makeTeam(name='test-team') | 856 | self.team = self.factory.makeTeam(name='test-team') |
3323 | 857 | login_person(self.team.teamowner) | 857 | login_person(self.team.teamowner) |
3324 | 858 | 858 | ||
3325 | diff --git a/lib/lp/registry/browser/tests/test_teammembership.py b/lib/lp/registry/browser/tests/test_teammembership.py | |||
3326 | index 21c953f..a87d121 100644 | |||
3327 | --- a/lib/lp/registry/browser/tests/test_teammembership.py | |||
3328 | +++ b/lib/lp/registry/browser/tests/test_teammembership.py | |||
3329 | @@ -23,7 +23,7 @@ class TestTeamMenu(TestCaseWithFactory): | |||
3330 | 23 | layer = DatabaseFunctionalLayer | 23 | layer = DatabaseFunctionalLayer |
3331 | 24 | 24 | ||
3332 | 25 | def setUp(self): | 25 | def setUp(self): |
3334 | 26 | super(TestTeamMenu, self).setUp() | 26 | super().setUp() |
3335 | 27 | login_celebrity('admin') | 27 | login_celebrity('admin') |
3336 | 28 | self.membership_set = getUtility(ITeamMembershipSet) | 28 | self.membership_set = getUtility(ITeamMembershipSet) |
3337 | 29 | self.team = self.factory.makeTeam() | 29 | self.team = self.factory.makeTeam() |
3338 | diff --git a/lib/lp/registry/browser/widgets/ocicredentialswidget.py b/lib/lp/registry/browser/widgets/ocicredentialswidget.py | |||
3339 | index b47f436..924903d 100644 | |||
3340 | --- a/lib/lp/registry/browser/widgets/ocicredentialswidget.py | |||
3341 | +++ b/lib/lp/registry/browser/widgets/ocicredentialswidget.py | |||
3342 | @@ -113,7 +113,7 @@ class OCICredentialsWidget(BrowserWidget, InputWidget): | |||
3343 | 113 | self.getInputValue() | 113 | self.getInputValue() |
3344 | 114 | except InputErrors as error: | 114 | except InputErrors as error: |
3345 | 115 | self._error = error | 115 | self._error = error |
3347 | 116 | return super(OCICredentialsWidget, self).error() | 116 | return super().error() |
3348 | 117 | 117 | ||
3349 | 118 | def setRenderedValue(self, value): | 118 | def setRenderedValue(self, value): |
3350 | 119 | """See `IInputWidget`.""" | 119 | """See `IInputWidget`.""" |
3351 | diff --git a/lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py b/lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py | |||
3352 | index 5494439..430e6c3 100644 | |||
3353 | --- a/lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py | |||
3354 | +++ b/lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py | |||
3355 | @@ -32,11 +32,11 @@ class TestOCICredentialsWidget(OCIConfigHelperMixin, TestCaseWithFactory): | |||
3356 | 32 | layer = DatabaseFunctionalLayer | 32 | layer = DatabaseFunctionalLayer |
3357 | 33 | 33 | ||
3358 | 34 | def setUp(self): | 34 | def setUp(self): |
3360 | 35 | super(TestOCICredentialsWidget, self).setUp() | 35 | super().setUp() |
3361 | 36 | self.setConfig() | 36 | self.setConfig() |
3362 | 37 | field = Reference( | 37 | field = Reference( |
3363 | 38 | __name__="oci_registry_credentials", | 38 | __name__="oci_registry_credentials", |
3365 | 39 | schema=Interface, title=u"OCI Registry Credentials") | 39 | schema=Interface, title="OCI Registry Credentials") |
3366 | 40 | self.context = self.factory.makeDistribution() | 40 | self.context = self.factory.makeDistribution() |
3367 | 41 | field = field.bind(self.context) | 41 | field = field.bind(self.context) |
3368 | 42 | request = LaunchpadTestRequest() | 42 | request = LaunchpadTestRequest() |
3369 | @@ -163,7 +163,7 @@ class TestOCICredentialsWidget(OCIConfigHelperMixin, TestCaseWithFactory): | |||
3370 | 163 | def test_getInputValue_valid(self): | 163 | def test_getInputValue_valid(self): |
3371 | 164 | field = Reference( | 164 | field = Reference( |
3372 | 165 | __name__="oci_registry_credentials", | 165 | __name__="oci_registry_credentials", |
3374 | 166 | schema=Interface, title=u"OCI Registry Credentials") | 166 | schema=Interface, title="OCI Registry Credentials") |
3375 | 167 | self.context = self.factory.makeDistribution( | 167 | self.context = self.factory.makeDistribution( |
3376 | 168 | oci_project_admin=self.owner) | 168 | oci_project_admin=self.owner) |
3377 | 169 | field = field.bind(self.context) | 169 | field = field.bind(self.context) |
Self-approving (mechanical).