← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/custom-widget-no-class-advice-2 into lp:launchpad.

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

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/custom-widget-no-class-advice-2/+merge/353253

Next step after https://code.launchpad.net/~cjwatson/launchpad/custom-widget-no-class-advice-1/+merge/349631.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/custom-widget-no-class-advice-2 into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bug.py'
--- lib/lp/bugs/browser/bug.py	2016-10-05 08:44:13 +0000
+++ lib/lp/bugs/browser/bug.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """IBug related view classes."""
@@ -48,6 +48,7 @@
     getUtility,
     )
 from zope.event import notify
+from zope.formlib.widget import CustomWidgetFactory
 from zope.formlib.widgets import TextWidget
 from zope.interface import (
     implementer,
@@ -65,7 +66,6 @@
 from lp.app.browser.informationtype import InformationTypePortletMixin
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadEditFormView,
     LaunchpadFormView,
     )
@@ -372,8 +372,8 @@
 class MaloneView(LaunchpadFormView):
     """The Bugs front page."""
 
-    custom_widget('searchtext', TextWidget, displayWidth=50)
-    custom_widget('scope', ProjectScopeWidget)
+    custom_widget_searchtext = CustomWidgetFactory(TextWidget, displayWidth=50)
+    custom_widget_scope = ProjectScopeWidget
     schema = IFrontPageBugTaskSearch
     field_names = ['searchtext', 'scope']
 
@@ -737,8 +737,8 @@
     """The view for the edit bug page."""
 
     field_names = ['title', 'description', 'tags']
-    custom_widget('title', TextWidget, displayWidth=30)
-    custom_widget('tags', BugTagsWidget)
+    custom_widget_title = CustomWidgetFactory(TextWidget, displayWidth=30)
+    custom_widget_tags = BugTagsWidget
 
     @property
     def label(self):
@@ -842,8 +842,8 @@
 
     field_names = ['information_type', 'validate_change']
 
-    custom_widget('information_type', LaunchpadRadioWidgetWithDescription)
-    custom_widget('validate_change', GhostCheckBoxWidget)
+    custom_widget_information_type = LaunchpadRadioWidgetWithDescription
+    custom_widget_validate_change = GhostCheckBoxWidget
 
     @property
     def schema(self):
@@ -1225,7 +1225,7 @@
     label = "Does this bug affect you?"
     page_title = label
 
-    custom_widget('affects', LaunchpadRadioWidgetWithDescription)
+    custom_widget_affects = LaunchpadRadioWidgetWithDescription
 
     @property
     def initial_values(self):

=== modified file 'lib/lp/bugs/browser/bugalsoaffects.py'
--- lib/lp/bugs/browser/bugalsoaffects.py	2016-09-20 23:13:09 +0000
+++ lib/lp/bugs/browser/bugalsoaffects.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -21,6 +21,7 @@
 from zope.event import notify
 from zope.formlib import form
 from zope.formlib.interfaces import MissingInputError
+from zope.formlib.widget import CustomWidgetFactory
 from zope.formlib.widgets import DropdownWidget
 from zope.schema import Choice
 from zope.schema.vocabulary import (
@@ -31,7 +32,6 @@
 from lp import _
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadFormView,
     )
 from lp.app.browser.multistep import (
@@ -126,7 +126,7 @@
     template = ViewPageTemplateFile(
         '../templates/bugtask-choose-affected-product.pt')
 
-    custom_widget('product', SearchForUpstreamPopupWidget)
+    custom_widget_product = SearchForUpstreamPopupWidget
     label = u"Record as affecting another project"
     step_name = "choose_product"
 
@@ -224,7 +224,8 @@
     registered.
     """
 
-    custom_widget('bug_url', StrippedTextWidget, displayWidth=62)
+    custom_widget_bug_url = CustomWidgetFactory(
+        StrippedTextWidget, displayWidth=62)
 
     initial_focus_widget = 'bug_url'
     step_name = 'specify_remote_bug_url'
@@ -363,8 +364,7 @@
         else:
             return IAddBugTaskForm
 
-    custom_widget(
-        'sourcepackagename', BugTaskAlsoAffectsSourcePackageNameWidget)
+    custom_widget_sourcepackagename = BugTaskAlsoAffectsSourcePackageNameWidget
 
     template = ViewPageTemplateFile('../templates/bugtask-requestfix.pt')
 
@@ -564,11 +564,12 @@
     main_action_label = u'Add to Bug Report'
     schema = IAddBugTaskWithUpstreamLinkForm
 
-    custom_widget('link_upstream_how', LaunchpadRadioWidget,
-                  _displayItemForMissingValue=False)
-    custom_widget('bug_url', StrippedTextWidget, displayWidth=42)
-    custom_widget('upstream_email_address_done',
-                  StrippedTextWidget, displayWidth=42)
+    custom_widget_link_upstream_how = CustomWidgetFactory(
+        LaunchpadRadioWidget, _displayItemForMissingValue=False)
+    custom_widget_bug_url = CustomWidgetFactory(
+        StrippedTextWidget, displayWidth=42)
+    custom_widget_upstream_email_address_done = CustomWidgetFactory(
+        StrippedTextWidget, displayWidth=42)
 
     @property
     def field_names(self):
@@ -708,7 +709,8 @@
     BugTaskCreationStep's subclasses.
     """
 
-    custom_widget('bug_url', StrippedTextWidget, displayWidth=62)
+    custom_widget_bug_url = CustomWidgetFactory(
+        StrippedTextWidget, displayWidth=62)
     step_name = "bugtracker_creation"
     main_action_label = u'Register Bug Tracker and Add to Bug Report'
     _next_step = None
@@ -729,8 +731,10 @@
 
     _next_step = DistroBugTaskCreationStep
     _field_names = ['distribution', 'sourcepackagename', 'bug_url']
-    custom_widget('distribution', DropdownWidget, visible=False)
-    custom_widget('sourcepackagename', DropdownWidget, visible=False)
+    custom_widget_distribution = CustomWidgetFactory(
+        DropdownWidget, visible=False)
+    custom_widget_sourcepackagename = CustomWidgetFactory(
+        DropdownWidget, visible=False)
     label = "Also affects distribution/package"
     template = ViewPageTemplateFile(
         '../templates/bugtask-confirm-bugtracker-creation.pt')
@@ -741,9 +745,9 @@
     schema = IAddBugTaskWithUpstreamLinkForm
     _next_step = ProductBugTaskCreationStep
     _field_names = ['product', 'bug_url', 'link_upstream_how']
-    custom_widget('product', DropdownWidget, visible=False)
-    custom_widget('link_upstream_how',
-                  LaunchpadRadioWidget, visible=False)
+    custom_widget_product = CustomWidgetFactory(DropdownWidget, visible=False)
+    custom_widget_link_upstream_how = CustomWidgetFactory(
+        LaunchpadRadioWidget, visible=False)
     label = "Confirm project"
     template = ViewPageTemplateFile(
         '../templates/bugtask-confirm-bugtracker-creation.pt')
@@ -759,8 +763,9 @@
 
     label = "Register project affected by this bug"
     schema = IAddBugTaskWithProductCreationForm
-    custom_widget('bug_url', StrippedTextWidget, displayWidth=62)
-    custom_widget('existing_product', LaunchpadRadioWidget)
+    custom_widget_bug_url = CustomWidgetFactory(
+        StrippedTextWidget, displayWidth=62)
+    custom_widget_existing_product = LaunchpadRadioWidget
     existing_products = None
     MAX_PRODUCTS_TO_DISPLAY = 10
     licenses = [License.DONT_KNOW]

=== modified file 'lib/lp/bugs/browser/bugattachment.py'
--- lib/lp/bugs/browser/bugattachment.py	2016-01-26 15:47:37 +0000
+++ lib/lp/bugs/browser/bugattachment.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Bug attachment views."""
@@ -22,7 +22,6 @@
 
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadFormView,
     )
 from lp.app.widgets.itemswidgets import LaunchpadBooleanRadioWidget
@@ -197,7 +196,7 @@
 
     schema = IBugAttachmentIsPatchConfirmationForm
 
-    custom_widget('patch', LaunchpadBooleanRadioWidget)
+    custom_widget_patch = LaunchpadBooleanRadioWidget
 
     def __init__(self, context, request):
         LaunchpadFormView.__init__(self, context, request)

=== modified file 'lib/lp/bugs/browser/buglinktarget.py'
--- lib/lp/bugs/browser/buglinktarget.py	2015-10-15 14:09:50 +0000
+++ lib/lp/bugs/browser/buglinktarget.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Views for IBugLinkTarget."""
@@ -23,7 +23,6 @@
 from lp import _
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadFormView,
     )
 from lp.app.widgets.itemswidgets import LabeledMultiCheckBoxWidget
@@ -130,7 +129,7 @@
 
     label = _('Remove links to bug reports')
     schema = IUnlinkBugsForm
-    custom_widget('bugs', LabeledMultiCheckBoxWidget)
+    custom_widget_bugs = LabeledMultiCheckBoxWidget
     page_title = label
 
     @property

=== modified file 'lib/lp/bugs/browser/buglisting.py'
--- lib/lp/bugs/browser/buglisting.py	2017-06-14 02:56:41 +0000
+++ lib/lp/bugs/browser/buglisting.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """IBugTask-related browser views."""
@@ -52,10 +52,7 @@
 from lp import _
 from lp.answers.interfaces.questiontarget import IQuestionTarget
 from lp.app.browser.launchpad import iter_view_registrations
-from lp.app.browser.launchpadform import (
-    custom_widget,
-    LaunchpadFormView,
-    )
+from lp.app.browser.launchpadform import LaunchpadFormView
 from lp.app.browser.tales import (
     BugTrackerFormatterAPI,
     DateTimeFormatterAPI,
@@ -904,16 +901,16 @@
     # These widgets are customised so as to keep the presentation of this view
     # and its descendants consistent after refactoring to use
     # LaunchpadFormView as a parent.
-    custom_widget('searchtext', NewLineToSpacesWidget)
-    custom_widget('status_upstream', LabeledMultiCheckBoxWidget)
-    custom_widget('tag', BugTagsWidget)
-    custom_widget('tags_combinator', RadioWidget)
-    custom_widget('component', LabeledMultiCheckBoxWidget)
-    custom_widget('assignee', PersonPickerWidget)
-    custom_widget('bug_reporter', PersonPickerWidget)
-    custom_widget('bug_commenter', PersonPickerWidget)
-    custom_widget('structural_subscriber', PersonPickerWidget)
-    custom_widget('subscriber', PersonPickerWidget)
+    custom_widget_searchtext = NewLineToSpacesWidget
+    custom_widget_status_upstream = LabeledMultiCheckBoxWidget
+    custom_widget_tag = BugTagsWidget
+    custom_widget_tags_combinator = RadioWidget
+    custom_widget_component = LabeledMultiCheckBoxWidget
+    custom_widget_assignee = PersonPickerWidget
+    custom_widget_bug_reporter = PersonPickerWidget
+    custom_widget_bug_commenter = PersonPickerWidget
+    custom_widget_structural_subscriber = PersonPickerWidget
+    custom_widget_subscriber = PersonPickerWidget
 
     _batch_navigator = None
 
@@ -1697,7 +1694,7 @@
     columns_to_show = ["id", "summary", "bugtargetdisplayname",
                        "importance", "status", "heat"]
     schema = IFrontPageBugTaskSearch
-    custom_widget('scope', ProjectScopeWidget)
+    custom_widget_scope = ProjectScopeWidget
     label = page_title = 'Search all bug reports'
 
     def initialize(self):

=== modified file 'lib/lp/bugs/browser/bugmessage.py'
--- lib/lp/bugs/browser/bugmessage.py	2016-04-29 11:11:35 +0000
+++ lib/lp/bugs/browser/bugmessage.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """IBugMessage-related browser view classes."""
@@ -11,11 +11,11 @@
 from StringIO import StringIO
 
 from zope.component import getUtility
+from zope.formlib.widget import CustomWidgetFactory
 from zope.formlib.widgets import TextAreaWidget
 
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadFormView,
     )
 from lp.bugs.browser.bugattachment import BugAttachmentContentCheck
@@ -30,7 +30,8 @@
     schema = IBugMessageAddForm
     initial_focus_widget = None
 
-    custom_widget('comment', TextAreaWidget, cssClass='comment-text')
+    custom_widget_comment = CustomWidgetFactory(
+        TextAreaWidget, cssClass='comment-text')
 
     page_title = "Add a comment or attachment"
 

=== modified file 'lib/lp/bugs/browser/bugnomination.py'
--- lib/lp/bugs/browser/bugnomination.py	2016-10-05 08:44:13 +0000
+++ lib/lp/bugs/browser/bugnomination.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Browser view classes related to bug nominations."""
@@ -20,7 +20,6 @@
 from lp import _
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadFormView,
     )
 from lp.app.widgets.itemswidgets import LabeledMultiCheckBoxWidget
@@ -43,7 +42,7 @@
 
     schema = IBugNominationForm
     initial_focus_widget = None
-    custom_widget('nominatable_series', LabeledMultiCheckBoxWidget)
+    custom_widget_nominatable_series = LabeledMultiCheckBoxWidget
 
     def __init__(self, context, request):
         self.current_bugtask = context

=== modified file 'lib/lp/bugs/browser/bugsubscriptionfilter.py'
--- lib/lp/bugs/browser/bugsubscriptionfilter.py	2013-04-10 08:09:05 +0000
+++ lib/lp/bugs/browser/bugsubscriptionfilter.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """View classes for bug subscription filters."""
@@ -9,11 +9,11 @@
     ]
 
 
+from zope.formlib.widget import CustomWidgetFactory
 from zope.formlib.widgets import TextWidget
 
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadEditFormView,
     )
 from lp.app.widgets.itemswidgets import LabeledMultiCheckBoxWidget
@@ -116,11 +116,13 @@
         "find_all_tags",
         )
 
-    custom_widget("description", TextWidget, displayWidth=50)
-    custom_widget("statuses", LabeledMultiCheckBoxWidget)
-    custom_widget("importances", LabeledMultiCheckBoxWidget)
-    custom_widget("information_types", LabeledMultiCheckBoxWidget)
-    custom_widget("tags", BugTagsFrozenSetWidget, displayWidth=35)
+    custom_widget_description = CustomWidgetFactory(
+        TextWidget, displayWidth=50)
+    custom_widget_statuses = LabeledMultiCheckBoxWidget
+    custom_widget_importances = LabeledMultiCheckBoxWidget
+    custom_widget_information_types = LabeledMultiCheckBoxWidget
+    custom_widget_tags = CustomWidgetFactory(
+        BugTagsFrozenSetWidget, displayWidth=35)
 
     # Define in concrete subclass to be the target of the
     # structural subscription that we are modifying.

=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py	2017-07-21 14:06:38 +0000
+++ lib/lp/bugs/browser/bugtarget.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """IBugTarget-related browser views."""
@@ -35,6 +35,7 @@
 from zope.component import getUtility
 from zope.formlib.form import Fields
 from zope.formlib.interfaces import InputErrors
+from zope.formlib.widget import CustomWidgetFactory
 from zope.formlib.widgets import (
     TextAreaWidget,
     TextWidget,
@@ -53,7 +54,6 @@
 
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadEditFormView,
     LaunchpadFormView,
     safe_action,
@@ -182,9 +182,9 @@
     schema = IProductBugConfiguration
     # This ProductBugTrackerWidget renders enable_bug_expiration and
     # remote_product as subordinate fields, so this view suppresses them.
-    custom_widget('bugtracker', ProductBugTrackerWidget)
-    custom_widget('enable_bug_expiration', GhostCheckBoxWidget)
-    custom_widget('remote_product', GhostWidget)
+    custom_widget_bugtracker = ProductBugTrackerWidget
+    custom_widget_enable_bug_expiration = GhostCheckBoxWidget
+    custom_widget_remote_product = GhostWidget
 
     @property
     def field_names(self):
@@ -225,9 +225,10 @@
 
     schema = IBug
 
-    custom_widget('information_type', LaunchpadRadioWidgetWithDescription)
-    custom_widget('comment', TextAreaWidget, cssClass='comment-text')
-    custom_widget('packagename', FileBugSourcePackageNameWidget)
+    custom_widget_information_type = LaunchpadRadioWidgetWithDescription
+    custom_widget_comment = CustomWidgetFactory(
+        TextAreaWidget, cssClass='comment-text')
+    custom_widget_packagename = FileBugSourcePackageNameWidget
 
     extra_data_token = None
 
@@ -925,8 +926,8 @@
     # XXX: Brad Bollenbach 2006-10-04: This assignment to actions is a
     # hack to make the action decorator Just Work across inheritance.
     actions = FileBugViewBase.actions
-    custom_widget('title', TextWidget, displayWidth=40)
-    custom_widget('tags', BugTagsWidget)
+    custom_widget_title = CustomWidgetFactory(TextWidget, displayWidth=40)
+    custom_widget_tags = BugTagsWidget
 
     _MATCHING_BUGS_LIMIT = 10
     show_summary_in_results = False
@@ -1053,8 +1054,8 @@
 
     schema = IProjectGroupBugAddForm
 
-    custom_widget('title', TextWidget, displayWidth=40)
-    custom_widget('tags', BugTagsWidget)
+    custom_widget_title = CustomWidgetFactory(TextWidget, displayWidth=40)
+    custom_widget_tags = BugTagsWidget
 
     extra_data_to_process = False
 
@@ -1243,7 +1244,7 @@
     """View class for management of official bug tags."""
 
     schema = IOfficialBugTagTargetPublic
-    custom_widget('official_bug_tags', LargeBugTagsWidget)
+    custom_widget_official_bug_tags = LargeBugTagsWidget
 
     label = 'Manage official bug tags'
 

=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py	2018-07-15 17:15:08 +0000
+++ lib/lp/bugs/browser/bugtask.py	2018-08-16 15:23:49 +0000
@@ -79,7 +79,6 @@
 from lp import _
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadEditFormView,
     LaunchpadFormView,
     ReturnToReferrerMixin,
@@ -1120,10 +1119,10 @@
     # the form.
     default_field_names = ['assignee', 'bugwatch', 'importance', 'milestone',
                            'status']
-    custom_widget('target', BugTaskTargetWidget)
-    custom_widget('sourcepackagename', BugTaskSourcePackageNameWidget)
-    custom_widget('bugwatch', BugTaskBugWatchWidget)
-    custom_widget('assignee', BugTaskAssigneeWidget)
+    custom_widget_target = BugTaskTargetWidget
+    custom_widget_sourcepackagename = BugTaskSourcePackageNameWidget
+    custom_widget_bugwatch = BugTaskBugWatchWidget
+    custom_widget_assignee = BugTaskAssigneeWidget
 
     def initialize(self):
         # Initialize user_is_subscribed, if it hasn't already been set.

=== modified file 'lib/lp/bugs/browser/bugtracker.py'
--- lib/lp/bugs/browser/bugtracker.py	2017-01-06 23:44:45 +0000
+++ lib/lp/bugs/browser/bugtracker.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Bug tracker views."""
@@ -25,6 +25,7 @@
 from lazr.restful.utils import smartquote
 from zope.component import getUtility
 from zope.formlib import form
+from zope.formlib.widget import CustomWidgetFactory
 from zope.formlib.widgets import TextAreaWidget
 from zope.interface import implementer
 from zope.schema import Choice
@@ -33,7 +34,6 @@
 from lp import _
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadEditFormView,
     LaunchpadFormView,
     )
@@ -243,9 +243,11 @@
 
     schema = IBugTracker
 
-    custom_widget('summary', TextAreaWidget, width=30, height=5)
-    custom_widget('aliases', DelimitedListWidget, height=3)
-    custom_widget('active', LaunchpadRadioWidget, orientation='vertical')
+    custom_widget_summary = CustomWidgetFactory(
+        TextAreaWidget, width=30, height=5)
+    custom_widget_aliases = CustomWidgetFactory(DelimitedListWidget, height=3)
+    custom_widget_active = CustomWidgetFactory(
+        LaunchpadRadioWidget, orientation='vertical')
 
     @property
     def page_title(self):
@@ -464,7 +466,7 @@
     linked to source packages in the Ubuntu distribution.
     """
     schema = IBugTrackerComponent
-    custom_widget('sourcepackagename', UbuntuSourcePackageNameWidget)
+    custom_widget_sourcepackagename = UbuntuSourcePackageNameWidget
     field_names = ['sourcepackagename']
     page_title = 'Link component'
 

=== modified file 'lib/lp/bugs/browser/bugwatch.py'
--- lib/lp/bugs/browser/bugwatch.py	2015-10-15 14:09:50 +0000
+++ lib/lp/bugs/browser/bugwatch.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2013 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """IBugWatch-related browser views."""
@@ -17,7 +17,6 @@
 from lp import _
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadFormView,
     )
 from lp.app.widgets.textwidgets import URIWidget
@@ -93,7 +92,7 @@
 
     schema = BugWatchEditForm
     field_names = ['url']
-    custom_widget('url', URIWidget)
+    custom_widget_url = URIWidget
 
     @property
     def page_title(self):

=== modified file 'lib/lp/bugs/browser/structuralsubscription.py'
--- lib/lp/bugs/browser/structuralsubscription.py	2016-01-26 15:47:37 +0000
+++ lib/lp/bugs/browser/structuralsubscription.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2013 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -37,7 +37,6 @@
 
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadFormView,
     )
 from lp.app.enums import (
@@ -102,8 +101,8 @@
 
     schema = IStructuralSubscriptionForm
 
-    custom_widget('subscriptions_team', LabeledMultiCheckBoxWidget)
-    custom_widget('remove_other_subscriptions', LabeledMultiCheckBoxWidget)
+    custom_widget_subscriptions_team = LabeledMultiCheckBoxWidget
+    custom_widget_remove_other_subscriptions = LabeledMultiCheckBoxWidget
 
     page_title = 'Subscribe'
 

=== modified file 'lib/lp/buildmaster/browser/builder.py'
--- lib/lp/buildmaster/browser/builder.py	2016-10-03 13:02:24 +0000
+++ lib/lp/buildmaster/browser/builder.py	2018-08-16 15:23:49 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Browser views for builders."""
@@ -22,13 +22,13 @@
 from lazr.restful.utils import smartquote
 from zope.component import getUtility
 from zope.event import notify
+from zope.formlib.widget import CustomWidgetFactory
 from zope.formlib.widgets import TextWidget
 from zope.lifecycleevent import ObjectCreatedEvent
 
 from lp import _
 from lp.app.browser.launchpadform import (
     action,
-    custom_widget,
     LaunchpadEditFormView,
     LaunchpadFormView,
     )
@@ -350,10 +350,10 @@
         'name', 'title', 'processors', 'url', 'active', 'virtualized',
         'vm_host', 'vm_reset_protocol', 'owner'
         ]
-    custom_widget('owner', HiddenUserWidget)
-    custom_widget('url', TextWidget, displayWidth=30)
-    custom_widget('vm_host', TextWidget, displayWidth=30)
-    custom_widget('processors', LabeledMultiCheckBoxWidget)
+    custom_widget_owner = HiddenUserWidget
+    custom_widget_url = CustomWidgetFactory(TextWidget, displayWidth=30)
+    custom_widget_vm_host = CustomWidgetFactory(TextWidget, displayWidth=30)
+    custom_widget_processors = LabeledMultiCheckBoxWidget
 
     @action(_('Register builder'), name='register')
     def register_action(self, action, data):
@@ -393,7 +393,7 @@
         'virtualized', 'builderok', 'failnotes', 'vm_host',
         'vm_reset_protocol', 'active',
         ]
-    custom_widget('processors', LabeledMultiCheckBoxWidget)
+    custom_widget_processors = LabeledMultiCheckBoxWidget
 
     @action(_('Change'), name='update')
     def change_details(self, action, data):


Follow ups