launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #22914
[Merge] lp:~cjwatson/launchpad/custom-widget-no-class-advice-5 into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/custom-widget-no-class-advice-5 into lp:launchpad.
Commit message:
Finish removing Zope class advice from custom widget registration.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/custom-widget-no-class-advice-5/+merge/354843
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/custom-widget-no-class-advice-5 into lp:launchpad.
=== modified file 'lib/lp/app/browser/launchpadform.py'
--- lib/lp/app/browser/launchpadform.py 2018-08-09 14:31:23 +0000
+++ lib/lp/app/browser/launchpadform.py 2018-09-13 08:25:30 +0000
@@ -8,7 +8,6 @@
__all__ = [
'action',
- 'custom_widget',
'has_structured_doc',
'LaunchpadEditFormView',
'LaunchpadFormView',
@@ -41,7 +40,6 @@
implementer,
providedBy,
)
-from zope.interface.advice import addClassAdvisor
from zope.traversing.interfaces import (
ITraversable,
TraversalError,
@@ -80,8 +78,6 @@
schema = None
# Subset of fields to use
field_names = None
- # Dictionary mapping field names to custom widgets
- custom_widgets = {}
# The next URL to redirect to on successful form submission
next_url = None
@@ -205,8 +201,6 @@
if field.custom_widget is None:
widget = getattr(
self, 'custom_widget_%s' % field.__name__, None)
- if widget is None:
- widget = self.custom_widgets.get(field.__name__)
if widget is not None:
if IWidgetFactory.providedBy(widget):
field.custom_widget = widget
@@ -488,26 +482,6 @@
return was_changed
-class custom_widget:
- """A class advisor for overriding the default widget for a field."""
-
- def __init__(self, field_name, widget, *args, **kwargs):
- self.field_name = field_name
- if widget is None:
- self.widget = None
- else:
- self.widget = CustomWidgetFactory(widget, *args, **kwargs)
- addClassAdvisor(self.advise)
-
- def advise(self, cls):
- if cls.custom_widgets is None:
- cls.custom_widgets = {}
- else:
- cls.custom_widgets = dict(cls.custom_widgets)
- cls.custom_widgets[self.field_name] = self.widget
- return cls
-
-
def safe_action(action):
"""A decorator used to mark a particular action as 'safe'.
=== modified file 'lib/lp/services/features/browser/edit.py'
--- lib/lp/services/features/browser/edit.py 2013-04-10 08:09:05 +0000
+++ lib/lp/services/features/browser/edit.py 2018-09-13 08:25:30 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 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).
"""View and edit feature rules."""
@@ -13,13 +13,13 @@
from difflib import unified_diff
import logging
+from zope.formlib.widget import CustomWidgetFactory
from zope.formlib.widgets import TextAreaWidget
from zope.interface import Interface
from zope.schema import Text
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadFormView,
)
from lp.app.browser.stringformatter import FormattersAPI
@@ -59,7 +59,7 @@
page_title = label = 'Feature control'
diff = None
logger_name = 'lp.services.features'
- custom_widget('comment', TextAreaWidget, height=2)
+ custom_widget_comment = CustomWidgetFactory(TextAreaWidget, height=2)
@property
def field_names(self):
=== modified file 'lib/lp/services/verification/browser/logintoken.py'
--- lib/lp/services/verification/browser/logintoken.py 2018-03-02 16:17:35 +0000
+++ lib/lp/services/verification/browser/logintoken.py 2018-09-13 08:25:30 +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
@@ -18,6 +18,7 @@
import urllib
from zope.component import getUtility
+from zope.formlib.widget import CustomWidgetFactory
from zope.formlib.widgets import TextAreaWidget
from zope.interface import (
alsoProvides,
@@ -29,7 +30,6 @@
from lp import _
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadEditFormView,
LaunchpadFormView,
)
@@ -176,11 +176,12 @@
'teamowner', 'display_name', 'description', 'membership_policy',
'defaultmembershipperiod', 'renewal_policy', 'defaultrenewalperiod']
label = 'Claim Launchpad team'
- custom_widget('description', TextAreaWidget, height=10, width=30)
- custom_widget(
- 'renewal_policy', LaunchpadRadioWidget, orientation='vertical')
- custom_widget(
- 'membership_policy', LaunchpadRadioWidget, orientation='vertical')
+ custom_widget_description = CustomWidgetFactory(
+ TextAreaWidget, height=10, width=30)
+ custom_widget_renewal_policy = CustomWidgetFactory(
+ LaunchpadRadioWidget, orientation='vertical')
+ custom_widget_membership_policy = CustomWidgetFactory(
+ LaunchpadRadioWidget, orientation='vertical')
expected_token_types = (LoginTokenType.TEAMCLAIM,)
=== modified file 'lib/lp/services/webhooks/browser.py'
--- lib/lp/services/webhooks/browser.py 2015-10-26 11:47:38 +0000
+++ lib/lp/services/webhooks/browser.py 2018-09-13 08:25:30 +0000
@@ -1,4 +1,4 @@
-# Copyright 2015 Canonical Ltd. This software is licensed under the
+# Copyright 2015-2018 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Webhook browser and API classes."""
@@ -17,7 +17,6 @@
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadEditFormView,
LaunchpadFormView,
)
@@ -119,7 +118,7 @@
page_title = label = "Add webhook"
schema = WebhookEditSchema
- custom_widget('event_types', LabeledMultiCheckBoxWidget)
+ custom_widget_event_types = LabeledMultiCheckBoxWidget
@property
def inside_breadcrumb(self):
@@ -152,7 +151,7 @@
schema = WebhookEditSchema
# XXX wgrant 2015-08-04: Need custom widget for secret.
field_names = ['delivery_url', 'event_types', 'active']
- custom_widget('event_types', LabeledMultiCheckBoxWidget)
+ custom_widget_event_types = LabeledMultiCheckBoxWidget
def initialize(self):
super(WebhookView, self).initialize()
=== modified file 'lib/lp/snappy/browser/snap.py'
--- lib/lp/snappy/browser/snap.py 2018-08-30 16:15:20 +0000
+++ lib/lp/snappy/browser/snap.py 2018-09-13 08:25:30 +0000
@@ -25,6 +25,7 @@
)
from zope.component import getUtility
from zope.error.interfaces import IErrorReportingUtility
+from zope.formlib.widget import CustomWidgetFactory
from zope.interface import Interface
from zope.schema import (
Choice,
@@ -35,7 +36,6 @@
from lp import _
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadEditFormView,
LaunchpadFormView,
render_radio_widget_part,
@@ -263,9 +263,9 @@
description=u'The package stream within the source distribution '
'series to use when building the snap package.')
- custom_widget('archive', SnapArchiveWidget)
- custom_widget('distro_arch_series', LabeledMultiCheckBoxWidget)
- custom_widget('pocket', LaunchpadDropdownWidget)
+ custom_widget_archive = SnapArchiveWidget
+ custom_widget_distro_arch_series = LabeledMultiCheckBoxWidget
+ custom_widget_pocket = LaunchpadDropdownWidget
help_links = {
"pocket": u"/+help-snappy/snap-build-pocket.html",
@@ -400,11 +400,11 @@
'store_name',
'store_channels',
]
- custom_widget('store_distro_series', LaunchpadRadioWidget)
- custom_widget('auto_build_archive', SnapArchiveWidget)
- custom_widget('auto_build_pocket', LaunchpadDropdownWidget)
- custom_widget('auto_build_channels', SnapBuildChannelsWidget)
- custom_widget('store_channels', StoreChannelsWidget)
+ custom_widget_store_distro_series = LaunchpadRadioWidget
+ custom_widget_auto_build_archive = SnapArchiveWidget
+ custom_widget_auto_build_pocket = LaunchpadDropdownWidget
+ custom_widget_auto_build_channels = SnapBuildChannelsWidget
+ custom_widget_store_channels = StoreChannelsWidget
help_links = {
"auto_build_pocket": u"/+help-snappy/snap-build-pocket.html",
@@ -696,13 +696,14 @@
'store_name',
'store_channels',
]
- custom_widget('store_distro_series', LaunchpadRadioWidget)
- custom_widget('vcs', LaunchpadRadioWidget)
- custom_widget('git_ref', GitRefWidget, allow_external=True)
- custom_widget('auto_build_archive', SnapArchiveWidget)
- custom_widget('auto_build_pocket', LaunchpadDropdownWidget)
- custom_widget('auto_build_channels', SnapBuildChannelsWidget)
- custom_widget('store_channels', StoreChannelsWidget)
+ custom_widget_store_distro_series = LaunchpadRadioWidget
+ custom_widget_vcs = LaunchpadRadioWidget
+ custom_widget_git_ref = CustomWidgetFactory(
+ GitRefWidget, allow_external=True)
+ custom_widget_auto_build_archive = SnapArchiveWidget
+ custom_widget_auto_build_pocket = LaunchpadDropdownWidget
+ custom_widget_auto_build_channels = SnapBuildChannelsWidget
+ custom_widget_store_channels = StoreChannelsWidget
help_links = {
"auto_build_pocket": u"/+help-snappy/snap-build-pocket.html",
=== modified file 'lib/lp/soyuz/browser/archive.py'
--- lib/lp/soyuz/browser/archive.py 2018-05-11 17:52:11 +0000
+++ lib/lp/soyuz/browser/archive.py 2018-09-13 08:25:30 +0000
@@ -65,7 +65,6 @@
from lp.app.browser.badge import HasBadgeBase
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadEditFormView,
LaunchpadFormView,
)
@@ -830,8 +829,8 @@
"""A Form view for filtering and batching source packages."""
schema = IPPAPackageFilter
- custom_widget('series_filter', SeriesFilterWidget)
- custom_widget('status_filter', StatusFilterWidget)
+ custom_widget_series_filter = SeriesFilterWidget
+ custom_widget_status_filter = StatusFilterWidget
# By default this view will not display the sources with selectable
# checkboxes, but subclasses can override as needed.
@@ -1129,7 +1128,7 @@
class ArchiveSourceSelectionFormView(ArchiveSourcePackageListViewBase):
"""Base class to implement a source selection widget for PPAs."""
- custom_widget('selected_sources', LabeledMultiCheckBoxWidget)
+ custom_widget_selected_sources = LabeledMultiCheckBoxWidget
selectable_sources = True
@@ -1212,7 +1211,8 @@
"""
schema = IArchivePackageDeletionForm
- custom_widget('deletion_comment', StrippedTextWidget, displayWidth=50)
+ custom_widget_deletion_comment = CustomWidgetFactory(
+ StrippedTextWidget, displayWidth=50)
label = 'Delete packages'
@property
@@ -1450,9 +1450,9 @@
a copying action that can be performed upon a set of selected packages.
"""
schema = IPPAPackageFilter
- custom_widget('destination_archive', DestinationArchiveDropdownWidget)
- custom_widget('destination_series', DestinationSeriesDropdownWidget)
- custom_widget('include_binaries', LaunchpadRadioWidget)
+ custom_widget_destination_archive = DestinationArchiveDropdownWidget
+ custom_widget_destination_series = DestinationSeriesDropdownWidget
+ custom_widget_include_binaries = LaunchpadRadioWidget
label = 'Copy packages'
@property
@@ -1615,12 +1615,13 @@
schema = IArchiveEditDependenciesForm
- custom_widget('selected_dependencies', PlainMultiCheckBoxWidget,
- cssClass='line-through-when-checked ppa-dependencies')
- custom_widget('primary_dependencies', LaunchpadRadioWidget,
- cssClass='highlight-selected')
- custom_widget('primary_components', LaunchpadRadioWidget,
- cssClass='highlight-selected')
+ custom_widget_selected_dependencies = CustomWidgetFactory(
+ PlainMultiCheckBoxWidget,
+ cssClass='line-through-when-checked ppa-dependencies')
+ custom_widget_primary_dependencies = CustomWidgetFactory(
+ LaunchpadRadioWidget, cssClass='highlight-selected')
+ custom_widget_primary_components = CustomWidgetFactory(
+ LaunchpadRadioWidget, cssClass='highlight-selected')
label = "Edit PPA dependencies"
page_title = label
@@ -1922,8 +1923,8 @@
schema = IArchive
field_names = ('name', 'displayname', 'description')
- custom_widget('description', TextAreaWidget, height=3)
- custom_widget('name', PPANameWidget, label="URL")
+ custom_widget_description = CustomWidgetFactory(TextAreaWidget, height=3)
+ custom_widget_name = CustomWidgetFactory(PPANameWidget, label="URL")
label = 'Activate a Personal Package Archive'
page_title = 'Activate PPA'
@@ -2106,8 +2107,8 @@
'build_debug_symbols',
'publish_debug_symbols',
]
- custom_widget(
- 'description', TextAreaWidget, height=10, width=30)
+ custom_widget_description = CustomWidgetFactory(
+ TextAreaWidget, height=10, width=30)
page_title = 'Change details'
@property
@@ -2160,7 +2161,8 @@
'relative_build_score',
'external_dependencies',
]
- custom_widget('external_dependencies', TextAreaWidget, height=3)
+ custom_widget_external_dependencies = CustomWidgetFactory(
+ TextAreaWidget, height=3)
page_title = 'Administer'
@property
=== modified file 'lib/lp/soyuz/browser/archivesubscription.py'
--- lib/lp/soyuz/browser/archivesubscription.py 2015-09-24 11:30:01 +0000
+++ lib/lp/soyuz/browser/archivesubscription.py 2018-09-13 08:25:30 +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 related to archive subscriptions."""
@@ -33,7 +33,6 @@
from lp import _
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadEditFormView,
LaunchpadFormView,
)
@@ -130,10 +129,10 @@
schema = IArchiveSubscriberUI
field_names = ['subscriber', 'date_expires', 'description']
- custom_widget('description', TextWidget, displayWidth=40)
- custom_widget('date_expires', CustomWidgetFactory(DateWidget))
- custom_widget('subscriber', PersonPickerWidget,
- header="Select the subscriber")
+ custom_widget_description = CustomWidgetFactory(TextWidget, displayWidth=40)
+ custom_widget_date_expires = DateWidget
+ custom_widget_subscriber = CustomWidgetFactory(
+ PersonPickerWidget, header="Select the subscriber")
@property
def label(self):
@@ -245,8 +244,9 @@
schema = IArchiveSubscriberUI
field_names = ['date_expires', 'description']
- custom_widget('description', TextWidget, displayWidth=40)
- custom_widget('date_expires', CustomWidgetFactory(DateWidget))
+ custom_widget_description = CustomWidgetFactory(
+ TextWidget, displayWidth=40)
+ custom_widget_date_expires = DateWidget
@property
def label(self):
=== modified file 'lib/lp/soyuz/browser/livefs.py'
--- lib/lp/soyuz/browser/livefs.py 2017-07-18 16:22:03 +0000
+++ lib/lp/soyuz/browser/livefs.py 2018-09-13 08:25:30 +0000
@@ -1,4 +1,4 @@
-# Copyright 2014-2017 Canonical Ltd. This software is licensed under the
+# Copyright 2014-2018 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""LiveFS views."""
@@ -29,7 +29,6 @@
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadEditFormView,
LaunchpadFormView,
)
@@ -210,7 +209,7 @@
schema = ILiveFSEditSchema
field_names = ['owner', 'name', 'distro_series', 'metadata']
- custom_widget('distro_series', LaunchpadRadioWidget)
+ custom_widget_distro_series = LaunchpadRadioWidget
def initialize(self):
"""See `LaunchpadView`."""
@@ -303,7 +302,7 @@
label = title
field_names = ['owner', 'name', 'distro_series', 'metadata']
- custom_widget('distro_series', LaunchpadRadioWidget)
+ custom_widget_distro_series = LaunchpadRadioWidget
@property
def initial_values(self):
=== modified file 'lib/lp/translations/browser/hastranslationimports.py'
--- lib/lp/translations/browser/hastranslationimports.py 2015-07-08 16:05:11 +0000
+++ lib/lp/translations/browser/hastranslationimports.py 2018-09-13 08:25:30 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 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 for IHasTranslationImports."""
@@ -16,6 +16,7 @@
from z3c.ptcompat import ViewPageTemplateFile
from zope.component import getUtility
from zope.formlib import form
+from zope.formlib.widget import CustomWidgetFactory
from zope.formlib.widgets import DropdownWidget
from zope.interface import implementer
from zope.schema import Choice
@@ -28,7 +29,6 @@
from lp import _
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadFormView,
safe_action,
)
@@ -55,11 +55,14 @@
schema = IHasTranslationImports
field_names = []
- custom_widget('filter_target', DropdownWidget, cssClass='inlined-widget')
- custom_widget('filter_status', DropdownWidget, cssClass='inlined-widget')
- custom_widget(
- 'filter_extension', DropdownWidget, cssClass='inlined-widget')
- custom_widget('status', DropdownWidget, cssClass='inlined-widget')
+ custom_widget_filter_target = CustomWidgetFactory(
+ DropdownWidget, cssClass='inlined-widget')
+ custom_widget_filter_status = CustomWidgetFactory(
+ DropdownWidget, cssClass='inlined-widget')
+ custom_widget_filter_extension = CustomWidgetFactory(
+ DropdownWidget, cssClass='inlined-widget')
+ custom_widget_status = CustomWidgetFactory(
+ DropdownWidget, cssClass='inlined-widget')
translation_import_queue_macros = ViewPageTemplateFile(
'../templates/translation-import-queue-macros.pt')
@@ -88,7 +91,7 @@
__name__=name,
source=source,
title=_(title)),
- custom_widget=self.custom_widgets[name],
+ custom_widget=getattr(self, 'custom_widget_%s' % name),
render_context=self.render_context)
def createFilterStatusField(self):
@@ -132,7 +135,7 @@
__name__=name,
source=EntryImportStatusVocabularyFactory(entry, self.user),
title=_('Select import status')),
- custom_widget=self.custom_widgets['status'],
+ custom_widget=self.custom_widgets_status,
render_context=self.render_context)
def setUpFields(self):
=== modified file 'lib/lp/translations/browser/language.py'
--- lib/lp/translations/browser/language.py 2013-04-10 08:09:05 +0000
+++ lib/lp/translations/browser/language.py 2018-09-13 08:25:30 +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).
"""Browser code for Language table."""
@@ -16,6 +16,7 @@
from zope.component import getUtility
from zope.event import notify
+from zope.formlib.widget import CustomWidgetFactory
from zope.formlib.widgets import TextWidget
from zope.interface import Interface
from zope.lifecycleevent import ObjectCreatedEvent
@@ -23,7 +24,6 @@
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadEditFormView,
LaunchpadFormView,
)
@@ -120,7 +120,8 @@
schema = ILanguageSetSearch
- custom_widget('search_lang', TextWidget, displayWidth=30)
+ custom_widget_search_lang = CustomWidgetFactory(
+ TextWidget, displayWidth=30)
def initialize(self):
"""See `LaunchpadFormView`."""
@@ -290,8 +291,8 @@
schema = ILanguage
- custom_widget('countries', LabeledMultiCheckBoxWidget,
- orientation='vertical')
+ custom_widget_countries = CustomWidgetFactory(
+ LabeledMultiCheckBoxWidget, orientation='vertical')
field_names = ['code', 'englishname', 'nativename', 'pluralforms',
'pluralexpression', 'visible', 'direction', 'countries']
=== modified file 'lib/lp/translations/browser/person.py'
--- lib/lp/translations/browser/person.py 2015-07-08 16:05:11 +0000
+++ lib/lp/translations/browser/person.py 2018-09-13 08:25:30 +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).
"""Person-related translations view classes."""
@@ -21,6 +21,7 @@
import pytz
from z3c.ptcompat import ViewPageTemplateFile
from zope.component import getUtility
+from zope.formlib.widget import CustomWidgetFactory
from zope.formlib.widgets import TextWidget
from zope.interface import (
implementer,
@@ -30,7 +31,6 @@
from lp import _
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadFormView,
)
from lp.app.enums import ServiceUsage
@@ -443,9 +443,9 @@
"""View for Person's translation relicensing page."""
schema = ITranslationRelicensingAgreementEdit
field_names = ['allow_relicensing', 'back_to']
- custom_widget(
- 'allow_relicensing', LaunchpadRadioWidget, orientation='vertical')
- custom_widget('back_to', TextWidget, visible=False)
+ custom_widget_allow_relicensing = CustomWidgetFactory(
+ LaunchpadRadioWidget, orientation='vertical')
+ custom_widget_back_to = CustomWidgetFactory(TextWidget, visible=False)
page_title = "Licensing"
=== modified file 'lib/lp/translations/browser/potemplate.py'
--- lib/lp/translations/browser/potemplate.py 2016-09-12 15:07:45 +0000
+++ lib/lp/translations/browser/potemplate.py 2018-09-13 08:25:30 +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).
"""Browser code for PO templates."""
@@ -42,7 +42,6 @@
from lp import _
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadEditFormView,
ReturnToReferrerMixin,
)
@@ -524,7 +523,7 @@
else:
return IPOTemplate
- custom_widget('sourcepackagename', POTemplateEditSourcePackageNameWidget)
+ custom_widget_sourcepackagename = POTemplateEditSourcePackageNameWidget
label = 'Edit translation template details'
page_title = 'Edit details'
PRIORITY_MIN_VALUE = 0
@@ -700,9 +699,9 @@
'from_sourcepackagename', 'sourcepackageversion',
'languagepack', 'path', 'source_file_format', 'priority',
'date_last_updated']
- custom_widget('sourcepackagename', POTemplateAdminSourcePackageNameWidget)
- custom_widget(
- 'from_sourcepackagename', POTemplateAdminSourcePackageNameWidget)
+ custom_widget_sourcepackagename = POTemplateAdminSourcePackageNameWidget
+ custom_widget_from_sourcepackagename = (
+ POTemplateAdminSourcePackageNameWidget)
label = 'Administer translation template'
page_title = "Administer"
=== modified file 'lib/lp/translations/browser/productseries.py'
--- lib/lp/translations/browser/productseries.py 2012-12-12 04:59:52 +0000
+++ lib/lp/translations/browser/productseries.py 2018-09-13 08:25:30 +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).
"""View classes for `IProductSeries`."""
@@ -25,7 +25,6 @@
from lp import _
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadEditFormView,
LaunchpadFormView,
ReturnToReferrerMixin,
@@ -486,8 +485,7 @@
page_title = "Settings"
field_names = ['translations_autoimport_mode']
- settings_widget = custom_widget('translations_autoimport_mode',
- SettingsRadioWidget)
+ custom_widget_translations_autoimport_mode = SettingsRadioWidget
@action(u"Save settings", name="save_settings")
def change_settings_action(self, action, data):
=== modified file 'lib/lp/translations/browser/translationimportqueue.py'
--- lib/lp/translations/browser/translationimportqueue.py 2016-09-12 17:41:21 +0000
+++ lib/lp/translations/browser/translationimportqueue.py 2018-09-13 08:25:30 +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).
"""Browser views for `ITranslationImportQueue`."""
@@ -27,7 +27,6 @@
from lp.app.browser.launchpadform import (
action,
- custom_widget,
LaunchpadFormView,
)
from lp.app.browser.tales import DateTimeFormatterAPI
@@ -113,8 +112,7 @@
else:
return IEditTranslationImportQueueEntry
- custom_widget(
- 'sourcepackagename',
+ custom_widget_sourcepackagename = (
TranslationImportQueueEntrySourcePackageNameWidget)
max_series_to_display = 3
Follow ups