Merge lp:~cjwatson/launchpad/custom-widget-no-class-advice-5 into lp:launchpad
- custom-widget-no-class-advice-5
- Merge into devel
Proposed by
Colin Watson
Status: | Merged |
---|---|
Merged at revision: | 18778 |
Proposed branch: | lp:~cjwatson/launchpad/custom-widget-no-class-advice-5 |
Merge into: | lp:launchpad |
Diff against target: |
684 lines (+95/-120) 14 files modified
lib/lp/app/browser/launchpadform.py (+0/-26) lib/lp/services/features/browser/edit.py (+3/-3) lib/lp/services/verification/browser/logintoken.py (+8/-7) lib/lp/services/webhooks/browser.py (+3/-4) lib/lp/snappy/browser/snap.py (+17/-16) lib/lp/soyuz/browser/archive.py (+21/-19) lib/lp/soyuz/browser/archivesubscription.py (+8/-8) lib/lp/soyuz/browser/livefs.py (+3/-4) lib/lp/translations/browser/hastranslationimports.py (+12/-9) lib/lp/translations/browser/language.py (+6/-5) lib/lp/translations/browser/person.py (+5/-5) lib/lp/translations/browser/potemplate.py (+5/-6) lib/lp/translations/browser/productseries.py (+2/-4) lib/lp/translations/browser/translationimportqueue.py (+2/-4) |
To merge this branch: | bzr merge lp:~cjwatson/launchpad/custom-widget-no-class-advice-5 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+354843@code.launchpad.net |
Commit message
Finish removing Zope class advice from custom widget registration.
Description of the change
To post a comment you must log in.
Revision history for this message
William Grant (wgrant) : | # |
review:
Approve
(code)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/app/browser/launchpadform.py' | |||
2 | --- lib/lp/app/browser/launchpadform.py 2018-08-09 14:31:23 +0000 | |||
3 | +++ lib/lp/app/browser/launchpadform.py 2018-09-13 08:25:30 +0000 | |||
4 | @@ -8,7 +8,6 @@ | |||
5 | 8 | 8 | ||
6 | 9 | __all__ = [ | 9 | __all__ = [ |
7 | 10 | 'action', | 10 | 'action', |
8 | 11 | 'custom_widget', | ||
9 | 12 | 'has_structured_doc', | 11 | 'has_structured_doc', |
10 | 13 | 'LaunchpadEditFormView', | 12 | 'LaunchpadEditFormView', |
11 | 14 | 'LaunchpadFormView', | 13 | 'LaunchpadFormView', |
12 | @@ -41,7 +40,6 @@ | |||
13 | 41 | implementer, | 40 | implementer, |
14 | 42 | providedBy, | 41 | providedBy, |
15 | 43 | ) | 42 | ) |
16 | 44 | from zope.interface.advice import addClassAdvisor | ||
17 | 45 | from zope.traversing.interfaces import ( | 43 | from zope.traversing.interfaces import ( |
18 | 46 | ITraversable, | 44 | ITraversable, |
19 | 47 | TraversalError, | 45 | TraversalError, |
20 | @@ -80,8 +78,6 @@ | |||
21 | 80 | schema = None | 78 | schema = None |
22 | 81 | # Subset of fields to use | 79 | # Subset of fields to use |
23 | 82 | field_names = None | 80 | field_names = None |
24 | 83 | # Dictionary mapping field names to custom widgets | ||
25 | 84 | custom_widgets = {} | ||
26 | 85 | 81 | ||
27 | 86 | # The next URL to redirect to on successful form submission | 82 | # The next URL to redirect to on successful form submission |
28 | 87 | next_url = None | 83 | next_url = None |
29 | @@ -205,8 +201,6 @@ | |||
30 | 205 | if field.custom_widget is None: | 201 | if field.custom_widget is None: |
31 | 206 | widget = getattr( | 202 | widget = getattr( |
32 | 207 | self, 'custom_widget_%s' % field.__name__, None) | 203 | self, 'custom_widget_%s' % field.__name__, None) |
33 | 208 | if widget is None: | ||
34 | 209 | widget = self.custom_widgets.get(field.__name__) | ||
35 | 210 | if widget is not None: | 204 | if widget is not None: |
36 | 211 | if IWidgetFactory.providedBy(widget): | 205 | if IWidgetFactory.providedBy(widget): |
37 | 212 | field.custom_widget = widget | 206 | field.custom_widget = widget |
38 | @@ -488,26 +482,6 @@ | |||
39 | 488 | return was_changed | 482 | return was_changed |
40 | 489 | 483 | ||
41 | 490 | 484 | ||
42 | 491 | class custom_widget: | ||
43 | 492 | """A class advisor for overriding the default widget for a field.""" | ||
44 | 493 | |||
45 | 494 | def __init__(self, field_name, widget, *args, **kwargs): | ||
46 | 495 | self.field_name = field_name | ||
47 | 496 | if widget is None: | ||
48 | 497 | self.widget = None | ||
49 | 498 | else: | ||
50 | 499 | self.widget = CustomWidgetFactory(widget, *args, **kwargs) | ||
51 | 500 | addClassAdvisor(self.advise) | ||
52 | 501 | |||
53 | 502 | def advise(self, cls): | ||
54 | 503 | if cls.custom_widgets is None: | ||
55 | 504 | cls.custom_widgets = {} | ||
56 | 505 | else: | ||
57 | 506 | cls.custom_widgets = dict(cls.custom_widgets) | ||
58 | 507 | cls.custom_widgets[self.field_name] = self.widget | ||
59 | 508 | return cls | ||
60 | 509 | |||
61 | 510 | |||
62 | 511 | def safe_action(action): | 485 | def safe_action(action): |
63 | 512 | """A decorator used to mark a particular action as 'safe'. | 486 | """A decorator used to mark a particular action as 'safe'. |
64 | 513 | 487 | ||
65 | 514 | 488 | ||
66 | === modified file 'lib/lp/services/features/browser/edit.py' | |||
67 | --- lib/lp/services/features/browser/edit.py 2013-04-10 08:09:05 +0000 | |||
68 | +++ lib/lp/services/features/browser/edit.py 2018-09-13 08:25:30 +0000 | |||
69 | @@ -1,4 +1,4 @@ | |||
71 | 1 | # Copyright 2010 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
72 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
73 | 3 | 3 | ||
74 | 4 | """View and edit feature rules.""" | 4 | """View and edit feature rules.""" |
75 | @@ -13,13 +13,13 @@ | |||
76 | 13 | from difflib import unified_diff | 13 | from difflib import unified_diff |
77 | 14 | import logging | 14 | import logging |
78 | 15 | 15 | ||
79 | 16 | from zope.formlib.widget import CustomWidgetFactory | ||
80 | 16 | from zope.formlib.widgets import TextAreaWidget | 17 | from zope.formlib.widgets import TextAreaWidget |
81 | 17 | from zope.interface import Interface | 18 | from zope.interface import Interface |
82 | 18 | from zope.schema import Text | 19 | from zope.schema import Text |
83 | 19 | 20 | ||
84 | 20 | from lp.app.browser.launchpadform import ( | 21 | from lp.app.browser.launchpadform import ( |
85 | 21 | action, | 22 | action, |
86 | 22 | custom_widget, | ||
87 | 23 | LaunchpadFormView, | 23 | LaunchpadFormView, |
88 | 24 | ) | 24 | ) |
89 | 25 | from lp.app.browser.stringformatter import FormattersAPI | 25 | from lp.app.browser.stringformatter import FormattersAPI |
90 | @@ -59,7 +59,7 @@ | |||
91 | 59 | page_title = label = 'Feature control' | 59 | page_title = label = 'Feature control' |
92 | 60 | diff = None | 60 | diff = None |
93 | 61 | logger_name = 'lp.services.features' | 61 | logger_name = 'lp.services.features' |
95 | 62 | custom_widget('comment', TextAreaWidget, height=2) | 62 | custom_widget_comment = CustomWidgetFactory(TextAreaWidget, height=2) |
96 | 63 | 63 | ||
97 | 64 | @property | 64 | @property |
98 | 65 | def field_names(self): | 65 | def field_names(self): |
99 | 66 | 66 | ||
100 | === modified file 'lib/lp/services/verification/browser/logintoken.py' | |||
101 | --- lib/lp/services/verification/browser/logintoken.py 2018-03-02 16:17:35 +0000 | |||
102 | +++ lib/lp/services/verification/browser/logintoken.py 2018-09-13 08:25:30 +0000 | |||
103 | @@ -1,4 +1,4 @@ | |||
105 | 1 | # Copyright 2009-2013 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
106 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
107 | 3 | 3 | ||
108 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
109 | @@ -18,6 +18,7 @@ | |||
110 | 18 | import urllib | 18 | import urllib |
111 | 19 | 19 | ||
112 | 20 | from zope.component import getUtility | 20 | from zope.component import getUtility |
113 | 21 | from zope.formlib.widget import CustomWidgetFactory | ||
114 | 21 | from zope.formlib.widgets import TextAreaWidget | 22 | from zope.formlib.widgets import TextAreaWidget |
115 | 22 | from zope.interface import ( | 23 | from zope.interface import ( |
116 | 23 | alsoProvides, | 24 | alsoProvides, |
117 | @@ -29,7 +30,6 @@ | |||
118 | 29 | from lp import _ | 30 | from lp import _ |
119 | 30 | from lp.app.browser.launchpadform import ( | 31 | from lp.app.browser.launchpadform import ( |
120 | 31 | action, | 32 | action, |
121 | 32 | custom_widget, | ||
122 | 33 | LaunchpadEditFormView, | 33 | LaunchpadEditFormView, |
123 | 34 | LaunchpadFormView, | 34 | LaunchpadFormView, |
124 | 35 | ) | 35 | ) |
125 | @@ -176,11 +176,12 @@ | |||
126 | 176 | 'teamowner', 'display_name', 'description', 'membership_policy', | 176 | 'teamowner', 'display_name', 'description', 'membership_policy', |
127 | 177 | 'defaultmembershipperiod', 'renewal_policy', 'defaultrenewalperiod'] | 177 | 'defaultmembershipperiod', 'renewal_policy', 'defaultrenewalperiod'] |
128 | 178 | label = 'Claim Launchpad team' | 178 | label = 'Claim Launchpad team' |
134 | 179 | custom_widget('description', TextAreaWidget, height=10, width=30) | 179 | custom_widget_description = CustomWidgetFactory( |
135 | 180 | custom_widget( | 180 | TextAreaWidget, height=10, width=30) |
136 | 181 | 'renewal_policy', LaunchpadRadioWidget, orientation='vertical') | 181 | custom_widget_renewal_policy = CustomWidgetFactory( |
137 | 182 | custom_widget( | 182 | LaunchpadRadioWidget, orientation='vertical') |
138 | 183 | 'membership_policy', LaunchpadRadioWidget, orientation='vertical') | 183 | custom_widget_membership_policy = CustomWidgetFactory( |
139 | 184 | LaunchpadRadioWidget, orientation='vertical') | ||
140 | 184 | 185 | ||
141 | 185 | expected_token_types = (LoginTokenType.TEAMCLAIM,) | 186 | expected_token_types = (LoginTokenType.TEAMCLAIM,) |
142 | 186 | 187 | ||
143 | 187 | 188 | ||
144 | === modified file 'lib/lp/services/webhooks/browser.py' | |||
145 | --- lib/lp/services/webhooks/browser.py 2015-10-26 11:47:38 +0000 | |||
146 | +++ lib/lp/services/webhooks/browser.py 2018-09-13 08:25:30 +0000 | |||
147 | @@ -1,4 +1,4 @@ | |||
149 | 1 | # Copyright 2015 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2015-2018 Canonical Ltd. This software is licensed under the |
150 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
151 | 3 | 3 | ||
152 | 4 | """Webhook browser and API classes.""" | 4 | """Webhook browser and API classes.""" |
153 | @@ -17,7 +17,6 @@ | |||
154 | 17 | 17 | ||
155 | 18 | from lp.app.browser.launchpadform import ( | 18 | from lp.app.browser.launchpadform import ( |
156 | 19 | action, | 19 | action, |
157 | 20 | custom_widget, | ||
158 | 21 | LaunchpadEditFormView, | 20 | LaunchpadEditFormView, |
159 | 22 | LaunchpadFormView, | 21 | LaunchpadFormView, |
160 | 23 | ) | 22 | ) |
161 | @@ -119,7 +118,7 @@ | |||
162 | 119 | page_title = label = "Add webhook" | 118 | page_title = label = "Add webhook" |
163 | 120 | 119 | ||
164 | 121 | schema = WebhookEditSchema | 120 | schema = WebhookEditSchema |
166 | 122 | custom_widget('event_types', LabeledMultiCheckBoxWidget) | 121 | custom_widget_event_types = LabeledMultiCheckBoxWidget |
167 | 123 | 122 | ||
168 | 124 | @property | 123 | @property |
169 | 125 | def inside_breadcrumb(self): | 124 | def inside_breadcrumb(self): |
170 | @@ -152,7 +151,7 @@ | |||
171 | 152 | schema = WebhookEditSchema | 151 | schema = WebhookEditSchema |
172 | 153 | # XXX wgrant 2015-08-04: Need custom widget for secret. | 152 | # XXX wgrant 2015-08-04: Need custom widget for secret. |
173 | 154 | field_names = ['delivery_url', 'event_types', 'active'] | 153 | field_names = ['delivery_url', 'event_types', 'active'] |
175 | 155 | custom_widget('event_types', LabeledMultiCheckBoxWidget) | 154 | custom_widget_event_types = LabeledMultiCheckBoxWidget |
176 | 156 | 155 | ||
177 | 157 | def initialize(self): | 156 | def initialize(self): |
178 | 158 | super(WebhookView, self).initialize() | 157 | super(WebhookView, self).initialize() |
179 | 159 | 158 | ||
180 | === modified file 'lib/lp/snappy/browser/snap.py' | |||
181 | --- lib/lp/snappy/browser/snap.py 2018-08-30 16:15:20 +0000 | |||
182 | +++ lib/lp/snappy/browser/snap.py 2018-09-13 08:25:30 +0000 | |||
183 | @@ -25,6 +25,7 @@ | |||
184 | 25 | ) | 25 | ) |
185 | 26 | from zope.component import getUtility | 26 | from zope.component import getUtility |
186 | 27 | from zope.error.interfaces import IErrorReportingUtility | 27 | from zope.error.interfaces import IErrorReportingUtility |
187 | 28 | from zope.formlib.widget import CustomWidgetFactory | ||
188 | 28 | from zope.interface import Interface | 29 | from zope.interface import Interface |
189 | 29 | from zope.schema import ( | 30 | from zope.schema import ( |
190 | 30 | Choice, | 31 | Choice, |
191 | @@ -35,7 +36,6 @@ | |||
192 | 35 | from lp import _ | 36 | from lp import _ |
193 | 36 | from lp.app.browser.launchpadform import ( | 37 | from lp.app.browser.launchpadform import ( |
194 | 37 | action, | 38 | action, |
195 | 38 | custom_widget, | ||
196 | 39 | LaunchpadEditFormView, | 39 | LaunchpadEditFormView, |
197 | 40 | LaunchpadFormView, | 40 | LaunchpadFormView, |
198 | 41 | render_radio_widget_part, | 41 | render_radio_widget_part, |
199 | @@ -263,9 +263,9 @@ | |||
200 | 263 | description=u'The package stream within the source distribution ' | 263 | description=u'The package stream within the source distribution ' |
201 | 264 | 'series to use when building the snap package.') | 264 | 'series to use when building the snap package.') |
202 | 265 | 265 | ||
206 | 266 | custom_widget('archive', SnapArchiveWidget) | 266 | custom_widget_archive = SnapArchiveWidget |
207 | 267 | custom_widget('distro_arch_series', LabeledMultiCheckBoxWidget) | 267 | custom_widget_distro_arch_series = LabeledMultiCheckBoxWidget |
208 | 268 | custom_widget('pocket', LaunchpadDropdownWidget) | 268 | custom_widget_pocket = LaunchpadDropdownWidget |
209 | 269 | 269 | ||
210 | 270 | help_links = { | 270 | help_links = { |
211 | 271 | "pocket": u"/+help-snappy/snap-build-pocket.html", | 271 | "pocket": u"/+help-snappy/snap-build-pocket.html", |
212 | @@ -400,11 +400,11 @@ | |||
213 | 400 | 'store_name', | 400 | 'store_name', |
214 | 401 | 'store_channels', | 401 | 'store_channels', |
215 | 402 | ] | 402 | ] |
221 | 403 | custom_widget('store_distro_series', LaunchpadRadioWidget) | 403 | custom_widget_store_distro_series = LaunchpadRadioWidget |
222 | 404 | custom_widget('auto_build_archive', SnapArchiveWidget) | 404 | custom_widget_auto_build_archive = SnapArchiveWidget |
223 | 405 | custom_widget('auto_build_pocket', LaunchpadDropdownWidget) | 405 | custom_widget_auto_build_pocket = LaunchpadDropdownWidget |
224 | 406 | custom_widget('auto_build_channels', SnapBuildChannelsWidget) | 406 | custom_widget_auto_build_channels = SnapBuildChannelsWidget |
225 | 407 | custom_widget('store_channels', StoreChannelsWidget) | 407 | custom_widget_store_channels = StoreChannelsWidget |
226 | 408 | 408 | ||
227 | 409 | help_links = { | 409 | help_links = { |
228 | 410 | "auto_build_pocket": u"/+help-snappy/snap-build-pocket.html", | 410 | "auto_build_pocket": u"/+help-snappy/snap-build-pocket.html", |
229 | @@ -696,13 +696,14 @@ | |||
230 | 696 | 'store_name', | 696 | 'store_name', |
231 | 697 | 'store_channels', | 697 | 'store_channels', |
232 | 698 | ] | 698 | ] |
240 | 699 | custom_widget('store_distro_series', LaunchpadRadioWidget) | 699 | custom_widget_store_distro_series = LaunchpadRadioWidget |
241 | 700 | custom_widget('vcs', LaunchpadRadioWidget) | 700 | custom_widget_vcs = LaunchpadRadioWidget |
242 | 701 | custom_widget('git_ref', GitRefWidget, allow_external=True) | 701 | custom_widget_git_ref = CustomWidgetFactory( |
243 | 702 | custom_widget('auto_build_archive', SnapArchiveWidget) | 702 | GitRefWidget, allow_external=True) |
244 | 703 | custom_widget('auto_build_pocket', LaunchpadDropdownWidget) | 703 | custom_widget_auto_build_archive = SnapArchiveWidget |
245 | 704 | custom_widget('auto_build_channels', SnapBuildChannelsWidget) | 704 | custom_widget_auto_build_pocket = LaunchpadDropdownWidget |
246 | 705 | custom_widget('store_channels', StoreChannelsWidget) | 705 | custom_widget_auto_build_channels = SnapBuildChannelsWidget |
247 | 706 | custom_widget_store_channels = StoreChannelsWidget | ||
248 | 706 | 707 | ||
249 | 707 | help_links = { | 708 | help_links = { |
250 | 708 | "auto_build_pocket": u"/+help-snappy/snap-build-pocket.html", | 709 | "auto_build_pocket": u"/+help-snappy/snap-build-pocket.html", |
251 | 709 | 710 | ||
252 | === modified file 'lib/lp/soyuz/browser/archive.py' | |||
253 | --- lib/lp/soyuz/browser/archive.py 2018-05-11 17:52:11 +0000 | |||
254 | +++ lib/lp/soyuz/browser/archive.py 2018-09-13 08:25:30 +0000 | |||
255 | @@ -65,7 +65,6 @@ | |||
256 | 65 | from lp.app.browser.badge import HasBadgeBase | 65 | from lp.app.browser.badge import HasBadgeBase |
257 | 66 | from lp.app.browser.launchpadform import ( | 66 | from lp.app.browser.launchpadform import ( |
258 | 67 | action, | 67 | action, |
259 | 68 | custom_widget, | ||
260 | 69 | LaunchpadEditFormView, | 68 | LaunchpadEditFormView, |
261 | 70 | LaunchpadFormView, | 69 | LaunchpadFormView, |
262 | 71 | ) | 70 | ) |
263 | @@ -830,8 +829,8 @@ | |||
264 | 830 | """A Form view for filtering and batching source packages.""" | 829 | """A Form view for filtering and batching source packages.""" |
265 | 831 | 830 | ||
266 | 832 | schema = IPPAPackageFilter | 831 | schema = IPPAPackageFilter |
269 | 833 | custom_widget('series_filter', SeriesFilterWidget) | 832 | custom_widget_series_filter = SeriesFilterWidget |
270 | 834 | custom_widget('status_filter', StatusFilterWidget) | 833 | custom_widget_status_filter = StatusFilterWidget |
271 | 835 | 834 | ||
272 | 836 | # By default this view will not display the sources with selectable | 835 | # By default this view will not display the sources with selectable |
273 | 837 | # checkboxes, but subclasses can override as needed. | 836 | # checkboxes, but subclasses can override as needed. |
274 | @@ -1129,7 +1128,7 @@ | |||
275 | 1129 | class ArchiveSourceSelectionFormView(ArchiveSourcePackageListViewBase): | 1128 | class ArchiveSourceSelectionFormView(ArchiveSourcePackageListViewBase): |
276 | 1130 | """Base class to implement a source selection widget for PPAs.""" | 1129 | """Base class to implement a source selection widget for PPAs.""" |
277 | 1131 | 1130 | ||
279 | 1132 | custom_widget('selected_sources', LabeledMultiCheckBoxWidget) | 1131 | custom_widget_selected_sources = LabeledMultiCheckBoxWidget |
280 | 1133 | 1132 | ||
281 | 1134 | selectable_sources = True | 1133 | selectable_sources = True |
282 | 1135 | 1134 | ||
283 | @@ -1212,7 +1211,8 @@ | |||
284 | 1212 | """ | 1211 | """ |
285 | 1213 | 1212 | ||
286 | 1214 | schema = IArchivePackageDeletionForm | 1213 | schema = IArchivePackageDeletionForm |
288 | 1215 | custom_widget('deletion_comment', StrippedTextWidget, displayWidth=50) | 1214 | custom_widget_deletion_comment = CustomWidgetFactory( |
289 | 1215 | StrippedTextWidget, displayWidth=50) | ||
290 | 1216 | label = 'Delete packages' | 1216 | label = 'Delete packages' |
291 | 1217 | 1217 | ||
292 | 1218 | @property | 1218 | @property |
293 | @@ -1450,9 +1450,9 @@ | |||
294 | 1450 | a copying action that can be performed upon a set of selected packages. | 1450 | a copying action that can be performed upon a set of selected packages. |
295 | 1451 | """ | 1451 | """ |
296 | 1452 | schema = IPPAPackageFilter | 1452 | schema = IPPAPackageFilter |
300 | 1453 | custom_widget('destination_archive', DestinationArchiveDropdownWidget) | 1453 | custom_widget_destination_archive = DestinationArchiveDropdownWidget |
301 | 1454 | custom_widget('destination_series', DestinationSeriesDropdownWidget) | 1454 | custom_widget_destination_series = DestinationSeriesDropdownWidget |
302 | 1455 | custom_widget('include_binaries', LaunchpadRadioWidget) | 1455 | custom_widget_include_binaries = LaunchpadRadioWidget |
303 | 1456 | label = 'Copy packages' | 1456 | label = 'Copy packages' |
304 | 1457 | 1457 | ||
305 | 1458 | @property | 1458 | @property |
306 | @@ -1615,12 +1615,13 @@ | |||
307 | 1615 | 1615 | ||
308 | 1616 | schema = IArchiveEditDependenciesForm | 1616 | schema = IArchiveEditDependenciesForm |
309 | 1617 | 1617 | ||
316 | 1618 | custom_widget('selected_dependencies', PlainMultiCheckBoxWidget, | 1618 | custom_widget_selected_dependencies = CustomWidgetFactory( |
317 | 1619 | cssClass='line-through-when-checked ppa-dependencies') | 1619 | PlainMultiCheckBoxWidget, |
318 | 1620 | custom_widget('primary_dependencies', LaunchpadRadioWidget, | 1620 | cssClass='line-through-when-checked ppa-dependencies') |
319 | 1621 | cssClass='highlight-selected') | 1621 | custom_widget_primary_dependencies = CustomWidgetFactory( |
320 | 1622 | custom_widget('primary_components', LaunchpadRadioWidget, | 1622 | LaunchpadRadioWidget, cssClass='highlight-selected') |
321 | 1623 | cssClass='highlight-selected') | 1623 | custom_widget_primary_components = CustomWidgetFactory( |
322 | 1624 | LaunchpadRadioWidget, cssClass='highlight-selected') | ||
323 | 1624 | 1625 | ||
324 | 1625 | label = "Edit PPA dependencies" | 1626 | label = "Edit PPA dependencies" |
325 | 1626 | page_title = label | 1627 | page_title = label |
326 | @@ -1922,8 +1923,8 @@ | |||
327 | 1922 | 1923 | ||
328 | 1923 | schema = IArchive | 1924 | schema = IArchive |
329 | 1924 | field_names = ('name', 'displayname', 'description') | 1925 | field_names = ('name', 'displayname', 'description') |
332 | 1925 | custom_widget('description', TextAreaWidget, height=3) | 1926 | custom_widget_description = CustomWidgetFactory(TextAreaWidget, height=3) |
333 | 1926 | custom_widget('name', PPANameWidget, label="URL") | 1927 | custom_widget_name = CustomWidgetFactory(PPANameWidget, label="URL") |
334 | 1927 | label = 'Activate a Personal Package Archive' | 1928 | label = 'Activate a Personal Package Archive' |
335 | 1928 | page_title = 'Activate PPA' | 1929 | page_title = 'Activate PPA' |
336 | 1929 | 1930 | ||
337 | @@ -2106,8 +2107,8 @@ | |||
338 | 2106 | 'build_debug_symbols', | 2107 | 'build_debug_symbols', |
339 | 2107 | 'publish_debug_symbols', | 2108 | 'publish_debug_symbols', |
340 | 2108 | ] | 2109 | ] |
343 | 2109 | custom_widget( | 2110 | custom_widget_description = CustomWidgetFactory( |
344 | 2110 | 'description', TextAreaWidget, height=10, width=30) | 2111 | TextAreaWidget, height=10, width=30) |
345 | 2111 | page_title = 'Change details' | 2112 | page_title = 'Change details' |
346 | 2112 | 2113 | ||
347 | 2113 | @property | 2114 | @property |
348 | @@ -2160,7 +2161,8 @@ | |||
349 | 2160 | 'relative_build_score', | 2161 | 'relative_build_score', |
350 | 2161 | 'external_dependencies', | 2162 | 'external_dependencies', |
351 | 2162 | ] | 2163 | ] |
353 | 2163 | custom_widget('external_dependencies', TextAreaWidget, height=3) | 2164 | custom_widget_external_dependencies = CustomWidgetFactory( |
354 | 2165 | TextAreaWidget, height=3) | ||
355 | 2164 | page_title = 'Administer' | 2166 | page_title = 'Administer' |
356 | 2165 | 2167 | ||
357 | 2166 | @property | 2168 | @property |
358 | 2167 | 2169 | ||
359 | === modified file 'lib/lp/soyuz/browser/archivesubscription.py' | |||
360 | --- lib/lp/soyuz/browser/archivesubscription.py 2015-09-24 11:30:01 +0000 | |||
361 | +++ lib/lp/soyuz/browser/archivesubscription.py 2018-09-13 08:25:30 +0000 | |||
362 | @@ -1,4 +1,4 @@ | |||
364 | 1 | # Copyright 2009-2015 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
365 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
366 | 3 | 3 | ||
367 | 4 | """Browser views related to archive subscriptions.""" | 4 | """Browser views related to archive subscriptions.""" |
368 | @@ -33,7 +33,6 @@ | |||
369 | 33 | from lp import _ | 33 | from lp import _ |
370 | 34 | from lp.app.browser.launchpadform import ( | 34 | from lp.app.browser.launchpadform import ( |
371 | 35 | action, | 35 | action, |
372 | 36 | custom_widget, | ||
373 | 37 | LaunchpadEditFormView, | 36 | LaunchpadEditFormView, |
374 | 38 | LaunchpadFormView, | 37 | LaunchpadFormView, |
375 | 39 | ) | 38 | ) |
376 | @@ -130,10 +129,10 @@ | |||
377 | 130 | 129 | ||
378 | 131 | schema = IArchiveSubscriberUI | 130 | schema = IArchiveSubscriberUI |
379 | 132 | field_names = ['subscriber', 'date_expires', 'description'] | 131 | field_names = ['subscriber', 'date_expires', 'description'] |
384 | 133 | custom_widget('description', TextWidget, displayWidth=40) | 132 | custom_widget_description = CustomWidgetFactory(TextWidget, displayWidth=40) |
385 | 134 | custom_widget('date_expires', CustomWidgetFactory(DateWidget)) | 133 | custom_widget_date_expires = DateWidget |
386 | 135 | custom_widget('subscriber', PersonPickerWidget, | 134 | custom_widget_subscriber = CustomWidgetFactory( |
387 | 136 | header="Select the subscriber") | 135 | PersonPickerWidget, header="Select the subscriber") |
388 | 137 | 136 | ||
389 | 138 | @property | 137 | @property |
390 | 139 | def label(self): | 138 | def label(self): |
391 | @@ -245,8 +244,9 @@ | |||
392 | 245 | 244 | ||
393 | 246 | schema = IArchiveSubscriberUI | 245 | schema = IArchiveSubscriberUI |
394 | 247 | field_names = ['date_expires', 'description'] | 246 | field_names = ['date_expires', 'description'] |
397 | 248 | custom_widget('description', TextWidget, displayWidth=40) | 247 | custom_widget_description = CustomWidgetFactory( |
398 | 249 | custom_widget('date_expires', CustomWidgetFactory(DateWidget)) | 248 | TextWidget, displayWidth=40) |
399 | 249 | custom_widget_date_expires = DateWidget | ||
400 | 250 | 250 | ||
401 | 251 | @property | 251 | @property |
402 | 252 | def label(self): | 252 | def label(self): |
403 | 253 | 253 | ||
404 | === modified file 'lib/lp/soyuz/browser/livefs.py' | |||
405 | --- lib/lp/soyuz/browser/livefs.py 2017-07-18 16:22:03 +0000 | |||
406 | +++ lib/lp/soyuz/browser/livefs.py 2018-09-13 08:25:30 +0000 | |||
407 | @@ -1,4 +1,4 @@ | |||
409 | 1 | # Copyright 2014-2017 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2014-2018 Canonical Ltd. This software is licensed under the |
410 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
411 | 3 | 3 | ||
412 | 4 | """LiveFS views.""" | 4 | """LiveFS views.""" |
413 | @@ -29,7 +29,6 @@ | |||
414 | 29 | 29 | ||
415 | 30 | from lp.app.browser.launchpadform import ( | 30 | from lp.app.browser.launchpadform import ( |
416 | 31 | action, | 31 | action, |
417 | 32 | custom_widget, | ||
418 | 33 | LaunchpadEditFormView, | 32 | LaunchpadEditFormView, |
419 | 34 | LaunchpadFormView, | 33 | LaunchpadFormView, |
420 | 35 | ) | 34 | ) |
421 | @@ -210,7 +209,7 @@ | |||
422 | 210 | 209 | ||
423 | 211 | schema = ILiveFSEditSchema | 210 | schema = ILiveFSEditSchema |
424 | 212 | field_names = ['owner', 'name', 'distro_series', 'metadata'] | 211 | field_names = ['owner', 'name', 'distro_series', 'metadata'] |
426 | 213 | custom_widget('distro_series', LaunchpadRadioWidget) | 212 | custom_widget_distro_series = LaunchpadRadioWidget |
427 | 214 | 213 | ||
428 | 215 | def initialize(self): | 214 | def initialize(self): |
429 | 216 | """See `LaunchpadView`.""" | 215 | """See `LaunchpadView`.""" |
430 | @@ -303,7 +302,7 @@ | |||
431 | 303 | label = title | 302 | label = title |
432 | 304 | 303 | ||
433 | 305 | field_names = ['owner', 'name', 'distro_series', 'metadata'] | 304 | field_names = ['owner', 'name', 'distro_series', 'metadata'] |
435 | 306 | custom_widget('distro_series', LaunchpadRadioWidget) | 305 | custom_widget_distro_series = LaunchpadRadioWidget |
436 | 307 | 306 | ||
437 | 308 | @property | 307 | @property |
438 | 309 | def initial_values(self): | 308 | def initial_values(self): |
439 | 310 | 309 | ||
440 | === modified file 'lib/lp/translations/browser/hastranslationimports.py' | |||
441 | --- lib/lp/translations/browser/hastranslationimports.py 2015-07-08 16:05:11 +0000 | |||
442 | +++ lib/lp/translations/browser/hastranslationimports.py 2018-09-13 08:25:30 +0000 | |||
443 | @@ -1,4 +1,4 @@ | |||
445 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
446 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
447 | 3 | 3 | ||
448 | 4 | """Browser view for IHasTranslationImports.""" | 4 | """Browser view for IHasTranslationImports.""" |
449 | @@ -16,6 +16,7 @@ | |||
450 | 16 | from z3c.ptcompat import ViewPageTemplateFile | 16 | from z3c.ptcompat import ViewPageTemplateFile |
451 | 17 | from zope.component import getUtility | 17 | from zope.component import getUtility |
452 | 18 | from zope.formlib import form | 18 | from zope.formlib import form |
453 | 19 | from zope.formlib.widget import CustomWidgetFactory | ||
454 | 19 | from zope.formlib.widgets import DropdownWidget | 20 | from zope.formlib.widgets import DropdownWidget |
455 | 20 | from zope.interface import implementer | 21 | from zope.interface import implementer |
456 | 21 | from zope.schema import Choice | 22 | from zope.schema import Choice |
457 | @@ -28,7 +29,6 @@ | |||
458 | 28 | from lp import _ | 29 | from lp import _ |
459 | 29 | from lp.app.browser.launchpadform import ( | 30 | from lp.app.browser.launchpadform import ( |
460 | 30 | action, | 31 | action, |
461 | 31 | custom_widget, | ||
462 | 32 | LaunchpadFormView, | 32 | LaunchpadFormView, |
463 | 33 | safe_action, | 33 | safe_action, |
464 | 34 | ) | 34 | ) |
465 | @@ -55,11 +55,14 @@ | |||
466 | 55 | schema = IHasTranslationImports | 55 | schema = IHasTranslationImports |
467 | 56 | field_names = [] | 56 | field_names = [] |
468 | 57 | 57 | ||
474 | 58 | custom_widget('filter_target', DropdownWidget, cssClass='inlined-widget') | 58 | custom_widget_filter_target = CustomWidgetFactory( |
475 | 59 | custom_widget('filter_status', DropdownWidget, cssClass='inlined-widget') | 59 | DropdownWidget, cssClass='inlined-widget') |
476 | 60 | custom_widget( | 60 | custom_widget_filter_status = CustomWidgetFactory( |
477 | 61 | 'filter_extension', DropdownWidget, cssClass='inlined-widget') | 61 | DropdownWidget, cssClass='inlined-widget') |
478 | 62 | custom_widget('status', DropdownWidget, cssClass='inlined-widget') | 62 | custom_widget_filter_extension = CustomWidgetFactory( |
479 | 63 | DropdownWidget, cssClass='inlined-widget') | ||
480 | 64 | custom_widget_status = CustomWidgetFactory( | ||
481 | 65 | DropdownWidget, cssClass='inlined-widget') | ||
482 | 63 | 66 | ||
483 | 64 | translation_import_queue_macros = ViewPageTemplateFile( | 67 | translation_import_queue_macros = ViewPageTemplateFile( |
484 | 65 | '../templates/translation-import-queue-macros.pt') | 68 | '../templates/translation-import-queue-macros.pt') |
485 | @@ -88,7 +91,7 @@ | |||
486 | 88 | __name__=name, | 91 | __name__=name, |
487 | 89 | source=source, | 92 | source=source, |
488 | 90 | title=_(title)), | 93 | title=_(title)), |
490 | 91 | custom_widget=self.custom_widgets[name], | 94 | custom_widget=getattr(self, 'custom_widget_%s' % name), |
491 | 92 | render_context=self.render_context) | 95 | render_context=self.render_context) |
492 | 93 | 96 | ||
493 | 94 | def createFilterStatusField(self): | 97 | def createFilterStatusField(self): |
494 | @@ -132,7 +135,7 @@ | |||
495 | 132 | __name__=name, | 135 | __name__=name, |
496 | 133 | source=EntryImportStatusVocabularyFactory(entry, self.user), | 136 | source=EntryImportStatusVocabularyFactory(entry, self.user), |
497 | 134 | title=_('Select import status')), | 137 | title=_('Select import status')), |
499 | 135 | custom_widget=self.custom_widgets['status'], | 138 | custom_widget=self.custom_widgets_status, |
500 | 136 | render_context=self.render_context) | 139 | render_context=self.render_context) |
501 | 137 | 140 | ||
502 | 138 | def setUpFields(self): | 141 | def setUpFields(self): |
503 | 139 | 142 | ||
504 | === modified file 'lib/lp/translations/browser/language.py' | |||
505 | --- lib/lp/translations/browser/language.py 2013-04-10 08:09:05 +0000 | |||
506 | +++ lib/lp/translations/browser/language.py 2018-09-13 08:25:30 +0000 | |||
507 | @@ -1,4 +1,4 @@ | |||
509 | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
510 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
511 | 3 | 3 | ||
512 | 4 | """Browser code for Language table.""" | 4 | """Browser code for Language table.""" |
513 | @@ -16,6 +16,7 @@ | |||
514 | 16 | 16 | ||
515 | 17 | from zope.component import getUtility | 17 | from zope.component import getUtility |
516 | 18 | from zope.event import notify | 18 | from zope.event import notify |
517 | 19 | from zope.formlib.widget import CustomWidgetFactory | ||
518 | 19 | from zope.formlib.widgets import TextWidget | 20 | from zope.formlib.widgets import TextWidget |
519 | 20 | from zope.interface import Interface | 21 | from zope.interface import Interface |
520 | 21 | from zope.lifecycleevent import ObjectCreatedEvent | 22 | from zope.lifecycleevent import ObjectCreatedEvent |
521 | @@ -23,7 +24,6 @@ | |||
522 | 23 | 24 | ||
523 | 24 | from lp.app.browser.launchpadform import ( | 25 | from lp.app.browser.launchpadform import ( |
524 | 25 | action, | 26 | action, |
525 | 26 | custom_widget, | ||
526 | 27 | LaunchpadEditFormView, | 27 | LaunchpadEditFormView, |
527 | 28 | LaunchpadFormView, | 28 | LaunchpadFormView, |
528 | 29 | ) | 29 | ) |
529 | @@ -120,7 +120,8 @@ | |||
530 | 120 | 120 | ||
531 | 121 | schema = ILanguageSetSearch | 121 | schema = ILanguageSetSearch |
532 | 122 | 122 | ||
534 | 123 | custom_widget('search_lang', TextWidget, displayWidth=30) | 123 | custom_widget_search_lang = CustomWidgetFactory( |
535 | 124 | TextWidget, displayWidth=30) | ||
536 | 124 | 125 | ||
537 | 125 | def initialize(self): | 126 | def initialize(self): |
538 | 126 | """See `LaunchpadFormView`.""" | 127 | """See `LaunchpadFormView`.""" |
539 | @@ -290,8 +291,8 @@ | |||
540 | 290 | 291 | ||
541 | 291 | schema = ILanguage | 292 | schema = ILanguage |
542 | 292 | 293 | ||
545 | 293 | custom_widget('countries', LabeledMultiCheckBoxWidget, | 294 | custom_widget_countries = CustomWidgetFactory( |
546 | 294 | orientation='vertical') | 295 | LabeledMultiCheckBoxWidget, orientation='vertical') |
547 | 295 | 296 | ||
548 | 296 | field_names = ['code', 'englishname', 'nativename', 'pluralforms', | 297 | field_names = ['code', 'englishname', 'nativename', 'pluralforms', |
549 | 297 | 'pluralexpression', 'visible', 'direction', 'countries'] | 298 | 'pluralexpression', 'visible', 'direction', 'countries'] |
550 | 298 | 299 | ||
551 | === modified file 'lib/lp/translations/browser/person.py' | |||
552 | --- lib/lp/translations/browser/person.py 2015-07-08 16:05:11 +0000 | |||
553 | +++ lib/lp/translations/browser/person.py 2018-09-13 08:25:30 +0000 | |||
554 | @@ -1,4 +1,4 @@ | |||
556 | 1 | # Copyright 2009-2013 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
557 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
558 | 3 | 3 | ||
559 | 4 | """Person-related translations view classes.""" | 4 | """Person-related translations view classes.""" |
560 | @@ -21,6 +21,7 @@ | |||
561 | 21 | import pytz | 21 | import pytz |
562 | 22 | from z3c.ptcompat import ViewPageTemplateFile | 22 | from z3c.ptcompat import ViewPageTemplateFile |
563 | 23 | from zope.component import getUtility | 23 | from zope.component import getUtility |
564 | 24 | from zope.formlib.widget import CustomWidgetFactory | ||
565 | 24 | from zope.formlib.widgets import TextWidget | 25 | from zope.formlib.widgets import TextWidget |
566 | 25 | from zope.interface import ( | 26 | from zope.interface import ( |
567 | 26 | implementer, | 27 | implementer, |
568 | @@ -30,7 +31,6 @@ | |||
569 | 30 | from lp import _ | 31 | from lp import _ |
570 | 31 | from lp.app.browser.launchpadform import ( | 32 | from lp.app.browser.launchpadform import ( |
571 | 32 | action, | 33 | action, |
572 | 33 | custom_widget, | ||
573 | 34 | LaunchpadFormView, | 34 | LaunchpadFormView, |
574 | 35 | ) | 35 | ) |
575 | 36 | from lp.app.enums import ServiceUsage | 36 | from lp.app.enums import ServiceUsage |
576 | @@ -443,9 +443,9 @@ | |||
577 | 443 | """View for Person's translation relicensing page.""" | 443 | """View for Person's translation relicensing page.""" |
578 | 444 | schema = ITranslationRelicensingAgreementEdit | 444 | schema = ITranslationRelicensingAgreementEdit |
579 | 445 | field_names = ['allow_relicensing', 'back_to'] | 445 | field_names = ['allow_relicensing', 'back_to'] |
583 | 446 | custom_widget( | 446 | custom_widget_allow_relicensing = CustomWidgetFactory( |
584 | 447 | 'allow_relicensing', LaunchpadRadioWidget, orientation='vertical') | 447 | LaunchpadRadioWidget, orientation='vertical') |
585 | 448 | custom_widget('back_to', TextWidget, visible=False) | 448 | custom_widget_back_to = CustomWidgetFactory(TextWidget, visible=False) |
586 | 449 | 449 | ||
587 | 450 | page_title = "Licensing" | 450 | page_title = "Licensing" |
588 | 451 | 451 | ||
589 | 452 | 452 | ||
590 | === modified file 'lib/lp/translations/browser/potemplate.py' | |||
591 | --- lib/lp/translations/browser/potemplate.py 2016-09-12 15:07:45 +0000 | |||
592 | +++ lib/lp/translations/browser/potemplate.py 2018-09-13 08:25:30 +0000 | |||
593 | @@ -1,4 +1,4 @@ | |||
595 | 1 | # Copyright 2009-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
596 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
597 | 3 | """Browser code for PO templates.""" | 3 | """Browser code for PO templates.""" |
598 | 4 | 4 | ||
599 | @@ -42,7 +42,6 @@ | |||
600 | 42 | from lp import _ | 42 | from lp import _ |
601 | 43 | from lp.app.browser.launchpadform import ( | 43 | from lp.app.browser.launchpadform import ( |
602 | 44 | action, | 44 | action, |
603 | 45 | custom_widget, | ||
604 | 46 | LaunchpadEditFormView, | 45 | LaunchpadEditFormView, |
605 | 47 | ReturnToReferrerMixin, | 46 | ReturnToReferrerMixin, |
606 | 48 | ) | 47 | ) |
607 | @@ -524,7 +523,7 @@ | |||
608 | 524 | else: | 523 | else: |
609 | 525 | return IPOTemplate | 524 | return IPOTemplate |
610 | 526 | 525 | ||
612 | 527 | custom_widget('sourcepackagename', POTemplateEditSourcePackageNameWidget) | 526 | custom_widget_sourcepackagename = POTemplateEditSourcePackageNameWidget |
613 | 528 | label = 'Edit translation template details' | 527 | label = 'Edit translation template details' |
614 | 529 | page_title = 'Edit details' | 528 | page_title = 'Edit details' |
615 | 530 | PRIORITY_MIN_VALUE = 0 | 529 | PRIORITY_MIN_VALUE = 0 |
616 | @@ -700,9 +699,9 @@ | |||
617 | 700 | 'from_sourcepackagename', 'sourcepackageversion', | 699 | 'from_sourcepackagename', 'sourcepackageversion', |
618 | 701 | 'languagepack', 'path', 'source_file_format', 'priority', | 700 | 'languagepack', 'path', 'source_file_format', 'priority', |
619 | 702 | 'date_last_updated'] | 701 | 'date_last_updated'] |
623 | 703 | custom_widget('sourcepackagename', POTemplateAdminSourcePackageNameWidget) | 702 | custom_widget_sourcepackagename = POTemplateAdminSourcePackageNameWidget |
624 | 704 | custom_widget( | 703 | custom_widget_from_sourcepackagename = ( |
625 | 705 | 'from_sourcepackagename', POTemplateAdminSourcePackageNameWidget) | 704 | POTemplateAdminSourcePackageNameWidget) |
626 | 706 | label = 'Administer translation template' | 705 | label = 'Administer translation template' |
627 | 707 | page_title = "Administer" | 706 | page_title = "Administer" |
628 | 708 | 707 | ||
629 | 709 | 708 | ||
630 | === modified file 'lib/lp/translations/browser/productseries.py' | |||
631 | --- lib/lp/translations/browser/productseries.py 2012-12-12 04:59:52 +0000 | |||
632 | +++ lib/lp/translations/browser/productseries.py 2018-09-13 08:25:30 +0000 | |||
633 | @@ -1,4 +1,4 @@ | |||
635 | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
636 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
637 | 3 | 3 | ||
638 | 4 | """View classes for `IProductSeries`.""" | 4 | """View classes for `IProductSeries`.""" |
639 | @@ -25,7 +25,6 @@ | |||
640 | 25 | from lp import _ | 25 | from lp import _ |
641 | 26 | from lp.app.browser.launchpadform import ( | 26 | from lp.app.browser.launchpadform import ( |
642 | 27 | action, | 27 | action, |
643 | 28 | custom_widget, | ||
644 | 29 | LaunchpadEditFormView, | 28 | LaunchpadEditFormView, |
645 | 30 | LaunchpadFormView, | 29 | LaunchpadFormView, |
646 | 31 | ReturnToReferrerMixin, | 30 | ReturnToReferrerMixin, |
647 | @@ -486,8 +485,7 @@ | |||
648 | 486 | page_title = "Settings" | 485 | page_title = "Settings" |
649 | 487 | 486 | ||
650 | 488 | field_names = ['translations_autoimport_mode'] | 487 | field_names = ['translations_autoimport_mode'] |
653 | 489 | settings_widget = custom_widget('translations_autoimport_mode', | 488 | custom_widget_translations_autoimport_mode = SettingsRadioWidget |
652 | 490 | SettingsRadioWidget) | ||
654 | 491 | 489 | ||
655 | 492 | @action(u"Save settings", name="save_settings") | 490 | @action(u"Save settings", name="save_settings") |
656 | 493 | def change_settings_action(self, action, data): | 491 | def change_settings_action(self, action, data): |
657 | 494 | 492 | ||
658 | === modified file 'lib/lp/translations/browser/translationimportqueue.py' | |||
659 | --- lib/lp/translations/browser/translationimportqueue.py 2016-09-12 17:41:21 +0000 | |||
660 | +++ lib/lp/translations/browser/translationimportqueue.py 2018-09-13 08:25:30 +0000 | |||
661 | @@ -1,4 +1,4 @@ | |||
663 | 1 | # Copyright 2009-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
664 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
665 | 3 | 3 | ||
666 | 4 | """Browser views for `ITranslationImportQueue`.""" | 4 | """Browser views for `ITranslationImportQueue`.""" |
667 | @@ -27,7 +27,6 @@ | |||
668 | 27 | 27 | ||
669 | 28 | from lp.app.browser.launchpadform import ( | 28 | from lp.app.browser.launchpadform import ( |
670 | 29 | action, | 29 | action, |
671 | 30 | custom_widget, | ||
672 | 31 | LaunchpadFormView, | 30 | LaunchpadFormView, |
673 | 32 | ) | 31 | ) |
674 | 33 | from lp.app.browser.tales import DateTimeFormatterAPI | 32 | from lp.app.browser.tales import DateTimeFormatterAPI |
675 | @@ -113,8 +112,7 @@ | |||
676 | 113 | else: | 112 | else: |
677 | 114 | return IEditTranslationImportQueueEntry | 113 | return IEditTranslationImportQueueEntry |
678 | 115 | 114 | ||
681 | 116 | custom_widget( | 115 | custom_widget_sourcepackagename = ( |
680 | 117 | 'sourcepackagename', | ||
682 | 118 | TranslationImportQueueEntrySourcePackageNameWidget) | 116 | TranslationImportQueueEntrySourcePackageNameWidget) |
683 | 119 | 117 | ||
684 | 120 | max_series_to_display = 3 | 118 | max_series_to_display = 3 |