Merge lp:~cjwatson/launchpad/custom-widget-no-class-advice-2 into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 18761
Proposed branch: lp:~cjwatson/launchpad/custom-widget-no-class-advice-2
Merge into: lp:launchpad
Diff against target: 668 lines (+103/-101)
14 files modified
lib/lp/bugs/browser/bug.py (+9/-9)
lib/lp/bugs/browser/bugalsoaffects.py (+24/-19)
lib/lp/bugs/browser/bugattachment.py (+2/-3)
lib/lp/bugs/browser/buglinktarget.py (+2/-3)
lib/lp/bugs/browser/buglisting.py (+13/-16)
lib/lp/bugs/browser/bugmessage.py (+4/-3)
lib/lp/bugs/browser/bugnomination.py (+2/-3)
lib/lp/bugs/browser/bugsubscriptionfilter.py (+9/-7)
lib/lp/bugs/browser/bugtarget.py (+14/-13)
lib/lp/bugs/browser/bugtask.py (+4/-5)
lib/lp/bugs/browser/bugtracker.py (+8/-6)
lib/lp/bugs/browser/bugwatch.py (+2/-3)
lib/lp/bugs/browser/structuralsubscription.py (+3/-4)
lib/lp/buildmaster/browser/builder.py (+7/-7)
To merge this branch: bzr merge lp:~cjwatson/launchpad/custom-widget-no-class-advice-2
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+353253@code.launchpad.net

Commit message

Remove Zope class advice from custom widget registration (part 2).

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/bugs/browser/bug.py'
2--- lib/lp/bugs/browser/bug.py 2016-10-05 08:44:13 +0000
3+++ lib/lp/bugs/browser/bug.py 2018-08-16 15:23:49 +0000
4@@ -1,4 +1,4 @@
5-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
6+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
7 # GNU Affero General Public License version 3 (see the file LICENSE).
8
9 """IBug related view classes."""
10@@ -48,6 +48,7 @@
11 getUtility,
12 )
13 from zope.event import notify
14+from zope.formlib.widget import CustomWidgetFactory
15 from zope.formlib.widgets import TextWidget
16 from zope.interface import (
17 implementer,
18@@ -65,7 +66,6 @@
19 from lp.app.browser.informationtype import InformationTypePortletMixin
20 from lp.app.browser.launchpadform import (
21 action,
22- custom_widget,
23 LaunchpadEditFormView,
24 LaunchpadFormView,
25 )
26@@ -372,8 +372,8 @@
27 class MaloneView(LaunchpadFormView):
28 """The Bugs front page."""
29
30- custom_widget('searchtext', TextWidget, displayWidth=50)
31- custom_widget('scope', ProjectScopeWidget)
32+ custom_widget_searchtext = CustomWidgetFactory(TextWidget, displayWidth=50)
33+ custom_widget_scope = ProjectScopeWidget
34 schema = IFrontPageBugTaskSearch
35 field_names = ['searchtext', 'scope']
36
37@@ -737,8 +737,8 @@
38 """The view for the edit bug page."""
39
40 field_names = ['title', 'description', 'tags']
41- custom_widget('title', TextWidget, displayWidth=30)
42- custom_widget('tags', BugTagsWidget)
43+ custom_widget_title = CustomWidgetFactory(TextWidget, displayWidth=30)
44+ custom_widget_tags = BugTagsWidget
45
46 @property
47 def label(self):
48@@ -842,8 +842,8 @@
49
50 field_names = ['information_type', 'validate_change']
51
52- custom_widget('information_type', LaunchpadRadioWidgetWithDescription)
53- custom_widget('validate_change', GhostCheckBoxWidget)
54+ custom_widget_information_type = LaunchpadRadioWidgetWithDescription
55+ custom_widget_validate_change = GhostCheckBoxWidget
56
57 @property
58 def schema(self):
59@@ -1225,7 +1225,7 @@
60 label = "Does this bug affect you?"
61 page_title = label
62
63- custom_widget('affects', LaunchpadRadioWidgetWithDescription)
64+ custom_widget_affects = LaunchpadRadioWidgetWithDescription
65
66 @property
67 def initial_values(self):
68
69=== modified file 'lib/lp/bugs/browser/bugalsoaffects.py'
70--- lib/lp/bugs/browser/bugalsoaffects.py 2016-09-20 23:13:09 +0000
71+++ lib/lp/bugs/browser/bugalsoaffects.py 2018-08-16 15:23:49 +0000
72@@ -1,4 +1,4 @@
73-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
74+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
75 # GNU Affero General Public License version 3 (see the file LICENSE).
76
77 __metaclass__ = type
78@@ -21,6 +21,7 @@
79 from zope.event import notify
80 from zope.formlib import form
81 from zope.formlib.interfaces import MissingInputError
82+from zope.formlib.widget import CustomWidgetFactory
83 from zope.formlib.widgets import DropdownWidget
84 from zope.schema import Choice
85 from zope.schema.vocabulary import (
86@@ -31,7 +32,6 @@
87 from lp import _
88 from lp.app.browser.launchpadform import (
89 action,
90- custom_widget,
91 LaunchpadFormView,
92 )
93 from lp.app.browser.multistep import (
94@@ -126,7 +126,7 @@
95 template = ViewPageTemplateFile(
96 '../templates/bugtask-choose-affected-product.pt')
97
98- custom_widget('product', SearchForUpstreamPopupWidget)
99+ custom_widget_product = SearchForUpstreamPopupWidget
100 label = u"Record as affecting another project"
101 step_name = "choose_product"
102
103@@ -224,7 +224,8 @@
104 registered.
105 """
106
107- custom_widget('bug_url', StrippedTextWidget, displayWidth=62)
108+ custom_widget_bug_url = CustomWidgetFactory(
109+ StrippedTextWidget, displayWidth=62)
110
111 initial_focus_widget = 'bug_url'
112 step_name = 'specify_remote_bug_url'
113@@ -363,8 +364,7 @@
114 else:
115 return IAddBugTaskForm
116
117- custom_widget(
118- 'sourcepackagename', BugTaskAlsoAffectsSourcePackageNameWidget)
119+ custom_widget_sourcepackagename = BugTaskAlsoAffectsSourcePackageNameWidget
120
121 template = ViewPageTemplateFile('../templates/bugtask-requestfix.pt')
122
123@@ -564,11 +564,12 @@
124 main_action_label = u'Add to Bug Report'
125 schema = IAddBugTaskWithUpstreamLinkForm
126
127- custom_widget('link_upstream_how', LaunchpadRadioWidget,
128- _displayItemForMissingValue=False)
129- custom_widget('bug_url', StrippedTextWidget, displayWidth=42)
130- custom_widget('upstream_email_address_done',
131- StrippedTextWidget, displayWidth=42)
132+ custom_widget_link_upstream_how = CustomWidgetFactory(
133+ LaunchpadRadioWidget, _displayItemForMissingValue=False)
134+ custom_widget_bug_url = CustomWidgetFactory(
135+ StrippedTextWidget, displayWidth=42)
136+ custom_widget_upstream_email_address_done = CustomWidgetFactory(
137+ StrippedTextWidget, displayWidth=42)
138
139 @property
140 def field_names(self):
141@@ -708,7 +709,8 @@
142 BugTaskCreationStep's subclasses.
143 """
144
145- custom_widget('bug_url', StrippedTextWidget, displayWidth=62)
146+ custom_widget_bug_url = CustomWidgetFactory(
147+ StrippedTextWidget, displayWidth=62)
148 step_name = "bugtracker_creation"
149 main_action_label = u'Register Bug Tracker and Add to Bug Report'
150 _next_step = None
151@@ -729,8 +731,10 @@
152
153 _next_step = DistroBugTaskCreationStep
154 _field_names = ['distribution', 'sourcepackagename', 'bug_url']
155- custom_widget('distribution', DropdownWidget, visible=False)
156- custom_widget('sourcepackagename', DropdownWidget, visible=False)
157+ custom_widget_distribution = CustomWidgetFactory(
158+ DropdownWidget, visible=False)
159+ custom_widget_sourcepackagename = CustomWidgetFactory(
160+ DropdownWidget, visible=False)
161 label = "Also affects distribution/package"
162 template = ViewPageTemplateFile(
163 '../templates/bugtask-confirm-bugtracker-creation.pt')
164@@ -741,9 +745,9 @@
165 schema = IAddBugTaskWithUpstreamLinkForm
166 _next_step = ProductBugTaskCreationStep
167 _field_names = ['product', 'bug_url', 'link_upstream_how']
168- custom_widget('product', DropdownWidget, visible=False)
169- custom_widget('link_upstream_how',
170- LaunchpadRadioWidget, visible=False)
171+ custom_widget_product = CustomWidgetFactory(DropdownWidget, visible=False)
172+ custom_widget_link_upstream_how = CustomWidgetFactory(
173+ LaunchpadRadioWidget, visible=False)
174 label = "Confirm project"
175 template = ViewPageTemplateFile(
176 '../templates/bugtask-confirm-bugtracker-creation.pt')
177@@ -759,8 +763,9 @@
178
179 label = "Register project affected by this bug"
180 schema = IAddBugTaskWithProductCreationForm
181- custom_widget('bug_url', StrippedTextWidget, displayWidth=62)
182- custom_widget('existing_product', LaunchpadRadioWidget)
183+ custom_widget_bug_url = CustomWidgetFactory(
184+ StrippedTextWidget, displayWidth=62)
185+ custom_widget_existing_product = LaunchpadRadioWidget
186 existing_products = None
187 MAX_PRODUCTS_TO_DISPLAY = 10
188 licenses = [License.DONT_KNOW]
189
190=== modified file 'lib/lp/bugs/browser/bugattachment.py'
191--- lib/lp/bugs/browser/bugattachment.py 2016-01-26 15:47:37 +0000
192+++ lib/lp/bugs/browser/bugattachment.py 2018-08-16 15:23:49 +0000
193@@ -1,4 +1,4 @@
194-# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
195+# Copyright 2010-2018 Canonical Ltd. This software is licensed under the
196 # GNU Affero General Public License version 3 (see the file LICENSE).
197
198 """Bug attachment views."""
199@@ -22,7 +22,6 @@
200
201 from lp.app.browser.launchpadform import (
202 action,
203- custom_widget,
204 LaunchpadFormView,
205 )
206 from lp.app.widgets.itemswidgets import LaunchpadBooleanRadioWidget
207@@ -197,7 +196,7 @@
208
209 schema = IBugAttachmentIsPatchConfirmationForm
210
211- custom_widget('patch', LaunchpadBooleanRadioWidget)
212+ custom_widget_patch = LaunchpadBooleanRadioWidget
213
214 def __init__(self, context, request):
215 LaunchpadFormView.__init__(self, context, request)
216
217=== modified file 'lib/lp/bugs/browser/buglinktarget.py'
218--- lib/lp/bugs/browser/buglinktarget.py 2015-10-15 14:09:50 +0000
219+++ lib/lp/bugs/browser/buglinktarget.py 2018-08-16 15:23:49 +0000
220@@ -1,4 +1,4 @@
221-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
222+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
223 # GNU Affero General Public License version 3 (see the file LICENSE).
224
225 """Views for IBugLinkTarget."""
226@@ -23,7 +23,6 @@
227 from lp import _
228 from lp.app.browser.launchpadform import (
229 action,
230- custom_widget,
231 LaunchpadFormView,
232 )
233 from lp.app.widgets.itemswidgets import LabeledMultiCheckBoxWidget
234@@ -130,7 +129,7 @@
235
236 label = _('Remove links to bug reports')
237 schema = IUnlinkBugsForm
238- custom_widget('bugs', LabeledMultiCheckBoxWidget)
239+ custom_widget_bugs = LabeledMultiCheckBoxWidget
240 page_title = label
241
242 @property
243
244=== modified file 'lib/lp/bugs/browser/buglisting.py'
245--- lib/lp/bugs/browser/buglisting.py 2017-06-14 02:56:41 +0000
246+++ lib/lp/bugs/browser/buglisting.py 2018-08-16 15:23:49 +0000
247@@ -1,4 +1,4 @@
248-# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
249+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
250 # GNU Affero General Public License version 3 (see the file LICENSE).
251
252 """IBugTask-related browser views."""
253@@ -52,10 +52,7 @@
254 from lp import _
255 from lp.answers.interfaces.questiontarget import IQuestionTarget
256 from lp.app.browser.launchpad import iter_view_registrations
257-from lp.app.browser.launchpadform import (
258- custom_widget,
259- LaunchpadFormView,
260- )
261+from lp.app.browser.launchpadform import LaunchpadFormView
262 from lp.app.browser.tales import (
263 BugTrackerFormatterAPI,
264 DateTimeFormatterAPI,
265@@ -904,16 +901,16 @@
266 # These widgets are customised so as to keep the presentation of this view
267 # and its descendants consistent after refactoring to use
268 # LaunchpadFormView as a parent.
269- custom_widget('searchtext', NewLineToSpacesWidget)
270- custom_widget('status_upstream', LabeledMultiCheckBoxWidget)
271- custom_widget('tag', BugTagsWidget)
272- custom_widget('tags_combinator', RadioWidget)
273- custom_widget('component', LabeledMultiCheckBoxWidget)
274- custom_widget('assignee', PersonPickerWidget)
275- custom_widget('bug_reporter', PersonPickerWidget)
276- custom_widget('bug_commenter', PersonPickerWidget)
277- custom_widget('structural_subscriber', PersonPickerWidget)
278- custom_widget('subscriber', PersonPickerWidget)
279+ custom_widget_searchtext = NewLineToSpacesWidget
280+ custom_widget_status_upstream = LabeledMultiCheckBoxWidget
281+ custom_widget_tag = BugTagsWidget
282+ custom_widget_tags_combinator = RadioWidget
283+ custom_widget_component = LabeledMultiCheckBoxWidget
284+ custom_widget_assignee = PersonPickerWidget
285+ custom_widget_bug_reporter = PersonPickerWidget
286+ custom_widget_bug_commenter = PersonPickerWidget
287+ custom_widget_structural_subscriber = PersonPickerWidget
288+ custom_widget_subscriber = PersonPickerWidget
289
290 _batch_navigator = None
291
292@@ -1697,7 +1694,7 @@
293 columns_to_show = ["id", "summary", "bugtargetdisplayname",
294 "importance", "status", "heat"]
295 schema = IFrontPageBugTaskSearch
296- custom_widget('scope', ProjectScopeWidget)
297+ custom_widget_scope = ProjectScopeWidget
298 label = page_title = 'Search all bug reports'
299
300 def initialize(self):
301
302=== modified file 'lib/lp/bugs/browser/bugmessage.py'
303--- lib/lp/bugs/browser/bugmessage.py 2016-04-29 11:11:35 +0000
304+++ lib/lp/bugs/browser/bugmessage.py 2018-08-16 15:23:49 +0000
305@@ -1,4 +1,4 @@
306-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
307+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
308 # GNU Affero General Public License version 3 (see the file LICENSE).
309
310 """IBugMessage-related browser view classes."""
311@@ -11,11 +11,11 @@
312 from StringIO import StringIO
313
314 from zope.component import getUtility
315+from zope.formlib.widget import CustomWidgetFactory
316 from zope.formlib.widgets import TextAreaWidget
317
318 from lp.app.browser.launchpadform import (
319 action,
320- custom_widget,
321 LaunchpadFormView,
322 )
323 from lp.bugs.browser.bugattachment import BugAttachmentContentCheck
324@@ -30,7 +30,8 @@
325 schema = IBugMessageAddForm
326 initial_focus_widget = None
327
328- custom_widget('comment', TextAreaWidget, cssClass='comment-text')
329+ custom_widget_comment = CustomWidgetFactory(
330+ TextAreaWidget, cssClass='comment-text')
331
332 page_title = "Add a comment or attachment"
333
334
335=== modified file 'lib/lp/bugs/browser/bugnomination.py'
336--- lib/lp/bugs/browser/bugnomination.py 2016-10-05 08:44:13 +0000
337+++ lib/lp/bugs/browser/bugnomination.py 2018-08-16 15:23:49 +0000
338@@ -1,4 +1,4 @@
339-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
340+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
341 # GNU Affero General Public License version 3 (see the file LICENSE).
342
343 """Browser view classes related to bug nominations."""
344@@ -20,7 +20,6 @@
345 from lp import _
346 from lp.app.browser.launchpadform import (
347 action,
348- custom_widget,
349 LaunchpadFormView,
350 )
351 from lp.app.widgets.itemswidgets import LabeledMultiCheckBoxWidget
352@@ -43,7 +42,7 @@
353
354 schema = IBugNominationForm
355 initial_focus_widget = None
356- custom_widget('nominatable_series', LabeledMultiCheckBoxWidget)
357+ custom_widget_nominatable_series = LabeledMultiCheckBoxWidget
358
359 def __init__(self, context, request):
360 self.current_bugtask = context
361
362=== modified file 'lib/lp/bugs/browser/bugsubscriptionfilter.py'
363--- lib/lp/bugs/browser/bugsubscriptionfilter.py 2013-04-10 08:09:05 +0000
364+++ lib/lp/bugs/browser/bugsubscriptionfilter.py 2018-08-16 15:23:49 +0000
365@@ -1,4 +1,4 @@
366-# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
367+# Copyright 2011-2018 Canonical Ltd. This software is licensed under the
368 # GNU Affero General Public License version 3 (see the file LICENSE).
369
370 """View classes for bug subscription filters."""
371@@ -9,11 +9,11 @@
372 ]
373
374
375+from zope.formlib.widget import CustomWidgetFactory
376 from zope.formlib.widgets import TextWidget
377
378 from lp.app.browser.launchpadform import (
379 action,
380- custom_widget,
381 LaunchpadEditFormView,
382 )
383 from lp.app.widgets.itemswidgets import LabeledMultiCheckBoxWidget
384@@ -116,11 +116,13 @@
385 "find_all_tags",
386 )
387
388- custom_widget("description", TextWidget, displayWidth=50)
389- custom_widget("statuses", LabeledMultiCheckBoxWidget)
390- custom_widget("importances", LabeledMultiCheckBoxWidget)
391- custom_widget("information_types", LabeledMultiCheckBoxWidget)
392- custom_widget("tags", BugTagsFrozenSetWidget, displayWidth=35)
393+ custom_widget_description = CustomWidgetFactory(
394+ TextWidget, displayWidth=50)
395+ custom_widget_statuses = LabeledMultiCheckBoxWidget
396+ custom_widget_importances = LabeledMultiCheckBoxWidget
397+ custom_widget_information_types = LabeledMultiCheckBoxWidget
398+ custom_widget_tags = CustomWidgetFactory(
399+ BugTagsFrozenSetWidget, displayWidth=35)
400
401 # Define in concrete subclass to be the target of the
402 # structural subscription that we are modifying.
403
404=== modified file 'lib/lp/bugs/browser/bugtarget.py'
405--- lib/lp/bugs/browser/bugtarget.py 2017-07-21 14:06:38 +0000
406+++ lib/lp/bugs/browser/bugtarget.py 2018-08-16 15:23:49 +0000
407@@ -1,4 +1,4 @@
408-# Copyright 2010-2016 Canonical Ltd. This software is licensed under the
409+# Copyright 2010-2018 Canonical Ltd. This software is licensed under the
410 # GNU Affero General Public License version 3 (see the file LICENSE).
411
412 """IBugTarget-related browser views."""
413@@ -35,6 +35,7 @@
414 from zope.component import getUtility
415 from zope.formlib.form import Fields
416 from zope.formlib.interfaces import InputErrors
417+from zope.formlib.widget import CustomWidgetFactory
418 from zope.formlib.widgets import (
419 TextAreaWidget,
420 TextWidget,
421@@ -53,7 +54,6 @@
422
423 from lp.app.browser.launchpadform import (
424 action,
425- custom_widget,
426 LaunchpadEditFormView,
427 LaunchpadFormView,
428 safe_action,
429@@ -182,9 +182,9 @@
430 schema = IProductBugConfiguration
431 # This ProductBugTrackerWidget renders enable_bug_expiration and
432 # remote_product as subordinate fields, so this view suppresses them.
433- custom_widget('bugtracker', ProductBugTrackerWidget)
434- custom_widget('enable_bug_expiration', GhostCheckBoxWidget)
435- custom_widget('remote_product', GhostWidget)
436+ custom_widget_bugtracker = ProductBugTrackerWidget
437+ custom_widget_enable_bug_expiration = GhostCheckBoxWidget
438+ custom_widget_remote_product = GhostWidget
439
440 @property
441 def field_names(self):
442@@ -225,9 +225,10 @@
443
444 schema = IBug
445
446- custom_widget('information_type', LaunchpadRadioWidgetWithDescription)
447- custom_widget('comment', TextAreaWidget, cssClass='comment-text')
448- custom_widget('packagename', FileBugSourcePackageNameWidget)
449+ custom_widget_information_type = LaunchpadRadioWidgetWithDescription
450+ custom_widget_comment = CustomWidgetFactory(
451+ TextAreaWidget, cssClass='comment-text')
452+ custom_widget_packagename = FileBugSourcePackageNameWidget
453
454 extra_data_token = None
455
456@@ -925,8 +926,8 @@
457 # XXX: Brad Bollenbach 2006-10-04: This assignment to actions is a
458 # hack to make the action decorator Just Work across inheritance.
459 actions = FileBugViewBase.actions
460- custom_widget('title', TextWidget, displayWidth=40)
461- custom_widget('tags', BugTagsWidget)
462+ custom_widget_title = CustomWidgetFactory(TextWidget, displayWidth=40)
463+ custom_widget_tags = BugTagsWidget
464
465 _MATCHING_BUGS_LIMIT = 10
466 show_summary_in_results = False
467@@ -1053,8 +1054,8 @@
468
469 schema = IProjectGroupBugAddForm
470
471- custom_widget('title', TextWidget, displayWidth=40)
472- custom_widget('tags', BugTagsWidget)
473+ custom_widget_title = CustomWidgetFactory(TextWidget, displayWidth=40)
474+ custom_widget_tags = BugTagsWidget
475
476 extra_data_to_process = False
477
478@@ -1243,7 +1244,7 @@
479 """View class for management of official bug tags."""
480
481 schema = IOfficialBugTagTargetPublic
482- custom_widget('official_bug_tags', LargeBugTagsWidget)
483+ custom_widget_official_bug_tags = LargeBugTagsWidget
484
485 label = 'Manage official bug tags'
486
487
488=== modified file 'lib/lp/bugs/browser/bugtask.py'
489--- lib/lp/bugs/browser/bugtask.py 2018-07-15 17:15:08 +0000
490+++ lib/lp/bugs/browser/bugtask.py 2018-08-16 15:23:49 +0000
491@@ -79,7 +79,6 @@
492 from lp import _
493 from lp.app.browser.launchpadform import (
494 action,
495- custom_widget,
496 LaunchpadEditFormView,
497 LaunchpadFormView,
498 ReturnToReferrerMixin,
499@@ -1120,10 +1119,10 @@
500 # the form.
501 default_field_names = ['assignee', 'bugwatch', 'importance', 'milestone',
502 'status']
503- custom_widget('target', BugTaskTargetWidget)
504- custom_widget('sourcepackagename', BugTaskSourcePackageNameWidget)
505- custom_widget('bugwatch', BugTaskBugWatchWidget)
506- custom_widget('assignee', BugTaskAssigneeWidget)
507+ custom_widget_target = BugTaskTargetWidget
508+ custom_widget_sourcepackagename = BugTaskSourcePackageNameWidget
509+ custom_widget_bugwatch = BugTaskBugWatchWidget
510+ custom_widget_assignee = BugTaskAssigneeWidget
511
512 def initialize(self):
513 # Initialize user_is_subscribed, if it hasn't already been set.
514
515=== modified file 'lib/lp/bugs/browser/bugtracker.py'
516--- lib/lp/bugs/browser/bugtracker.py 2017-01-06 23:44:45 +0000
517+++ lib/lp/bugs/browser/bugtracker.py 2018-08-16 15:23:49 +0000
518@@ -1,4 +1,4 @@
519-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
520+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
521 # GNU Affero General Public License version 3 (see the file LICENSE).
522
523 """Bug tracker views."""
524@@ -25,6 +25,7 @@
525 from lazr.restful.utils import smartquote
526 from zope.component import getUtility
527 from zope.formlib import form
528+from zope.formlib.widget import CustomWidgetFactory
529 from zope.formlib.widgets import TextAreaWidget
530 from zope.interface import implementer
531 from zope.schema import Choice
532@@ -33,7 +34,6 @@
533 from lp import _
534 from lp.app.browser.launchpadform import (
535 action,
536- custom_widget,
537 LaunchpadEditFormView,
538 LaunchpadFormView,
539 )
540@@ -243,9 +243,11 @@
541
542 schema = IBugTracker
543
544- custom_widget('summary', TextAreaWidget, width=30, height=5)
545- custom_widget('aliases', DelimitedListWidget, height=3)
546- custom_widget('active', LaunchpadRadioWidget, orientation='vertical')
547+ custom_widget_summary = CustomWidgetFactory(
548+ TextAreaWidget, width=30, height=5)
549+ custom_widget_aliases = CustomWidgetFactory(DelimitedListWidget, height=3)
550+ custom_widget_active = CustomWidgetFactory(
551+ LaunchpadRadioWidget, orientation='vertical')
552
553 @property
554 def page_title(self):
555@@ -464,7 +466,7 @@
556 linked to source packages in the Ubuntu distribution.
557 """
558 schema = IBugTrackerComponent
559- custom_widget('sourcepackagename', UbuntuSourcePackageNameWidget)
560+ custom_widget_sourcepackagename = UbuntuSourcePackageNameWidget
561 field_names = ['sourcepackagename']
562 page_title = 'Link component'
563
564
565=== modified file 'lib/lp/bugs/browser/bugwatch.py'
566--- lib/lp/bugs/browser/bugwatch.py 2015-10-15 14:09:50 +0000
567+++ lib/lp/bugs/browser/bugwatch.py 2018-08-16 15:23:49 +0000
568@@ -1,4 +1,4 @@
569-# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
570+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
571 # GNU Affero General Public License version 3 (see the file LICENSE).
572
573 """IBugWatch-related browser views."""
574@@ -17,7 +17,6 @@
575 from lp import _
576 from lp.app.browser.launchpadform import (
577 action,
578- custom_widget,
579 LaunchpadFormView,
580 )
581 from lp.app.widgets.textwidgets import URIWidget
582@@ -93,7 +92,7 @@
583
584 schema = BugWatchEditForm
585 field_names = ['url']
586- custom_widget('url', URIWidget)
587+ custom_widget_url = URIWidget
588
589 @property
590 def page_title(self):
591
592=== modified file 'lib/lp/bugs/browser/structuralsubscription.py'
593--- lib/lp/bugs/browser/structuralsubscription.py 2016-01-26 15:47:37 +0000
594+++ lib/lp/bugs/browser/structuralsubscription.py 2018-08-16 15:23:49 +0000
595@@ -1,4 +1,4 @@
596-# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
597+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
598 # GNU Affero General Public License version 3 (see the file LICENSE).
599
600 __metaclass__ = type
601@@ -37,7 +37,6 @@
602
603 from lp.app.browser.launchpadform import (
604 action,
605- custom_widget,
606 LaunchpadFormView,
607 )
608 from lp.app.enums import (
609@@ -102,8 +101,8 @@
610
611 schema = IStructuralSubscriptionForm
612
613- custom_widget('subscriptions_team', LabeledMultiCheckBoxWidget)
614- custom_widget('remove_other_subscriptions', LabeledMultiCheckBoxWidget)
615+ custom_widget_subscriptions_team = LabeledMultiCheckBoxWidget
616+ custom_widget_remove_other_subscriptions = LabeledMultiCheckBoxWidget
617
618 page_title = 'Subscribe'
619
620
621=== modified file 'lib/lp/buildmaster/browser/builder.py'
622--- lib/lp/buildmaster/browser/builder.py 2016-10-03 13:02:24 +0000
623+++ lib/lp/buildmaster/browser/builder.py 2018-08-16 15:23:49 +0000
624@@ -1,4 +1,4 @@
625-# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
626+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
627 # GNU Affero General Public License version 3 (see the file LICENSE).
628
629 """Browser views for builders."""
630@@ -22,13 +22,13 @@
631 from lazr.restful.utils import smartquote
632 from zope.component import getUtility
633 from zope.event import notify
634+from zope.formlib.widget import CustomWidgetFactory
635 from zope.formlib.widgets import TextWidget
636 from zope.lifecycleevent import ObjectCreatedEvent
637
638 from lp import _
639 from lp.app.browser.launchpadform import (
640 action,
641- custom_widget,
642 LaunchpadEditFormView,
643 LaunchpadFormView,
644 )
645@@ -350,10 +350,10 @@
646 'name', 'title', 'processors', 'url', 'active', 'virtualized',
647 'vm_host', 'vm_reset_protocol', 'owner'
648 ]
649- custom_widget('owner', HiddenUserWidget)
650- custom_widget('url', TextWidget, displayWidth=30)
651- custom_widget('vm_host', TextWidget, displayWidth=30)
652- custom_widget('processors', LabeledMultiCheckBoxWidget)
653+ custom_widget_owner = HiddenUserWidget
654+ custom_widget_url = CustomWidgetFactory(TextWidget, displayWidth=30)
655+ custom_widget_vm_host = CustomWidgetFactory(TextWidget, displayWidth=30)
656+ custom_widget_processors = LabeledMultiCheckBoxWidget
657
658 @action(_('Register builder'), name='register')
659 def register_action(self, action, data):
660@@ -393,7 +393,7 @@
661 'virtualized', 'builderok', 'failnotes', 'vm_host',
662 'vm_reset_protocol', 'active',
663 ]
664- custom_widget('processors', LabeledMultiCheckBoxWidget)
665+ custom_widget_processors = LabeledMultiCheckBoxWidget
666
667 @action(_('Change'), name='update')
668 def change_details(self, action, data):