Merge lp:~cjwatson/launchpad/custom-widget-no-class-advice-4 into lp:launchpad
- custom-widget-no-class-advice-4
- Merge into devel
Proposed by
Colin Watson
Status: | Merged |
---|---|
Merged at revision: | 18776 |
Proposed branch: | lp:~cjwatson/launchpad/custom-widget-no-class-advice-4 |
Merge into: | lp:launchpad |
Diff against target: |
712 lines (+143/-131) 9 files modified
lib/lp/registry/browser/person.py (+19/-18) lib/lp/registry/browser/poll.py (+4/-4) lib/lp/registry/browser/product.py (+58/-54) lib/lp/registry/browser/productrelease.py (+14/-9) lib/lp/registry/browser/productseries.py (+8/-6) lib/lp/registry/browser/project.py (+4/-3) lib/lp/registry/browser/sourcepackage.py (+6/-6) lib/lp/registry/browser/team.py (+28/-28) lib/lp/registry/doc/product-widgets.txt (+2/-3) |
To merge this branch: | bzr merge lp:~cjwatson/launchpad/custom-widget-no-class-advice-4 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+354107@code.launchpad.net |
Commit message
Remove Zope class advice from custom widget registration (part 4).
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/registry/browser/person.py' | |||
2 | --- lib/lp/registry/browser/person.py 2018-05-18 14:07:28 +0000 | |||
3 | +++ lib/lp/registry/browser/person.py 2018-08-31 11:41:19 +0000 | |||
4 | @@ -74,6 +74,7 @@ | |||
5 | 74 | from zope.error.interfaces import IErrorReportingUtility | 74 | from zope.error.interfaces import IErrorReportingUtility |
6 | 75 | from zope.formlib import form | 75 | from zope.formlib import form |
7 | 76 | from zope.formlib.form import FormFields | 76 | from zope.formlib.form import FormFields |
8 | 77 | from zope.formlib.widget import CustomWidgetFactory | ||
9 | 77 | from zope.formlib.widgets import ( | 78 | from zope.formlib.widgets import ( |
10 | 78 | TextAreaWidget, | 79 | TextAreaWidget, |
11 | 79 | TextWidget, | 80 | TextWidget, |
12 | @@ -101,7 +102,6 @@ | |||
13 | 101 | from lp import _ | 102 | from lp import _ |
14 | 102 | from lp.app.browser.launchpadform import ( | 103 | from lp.app.browser.launchpadform import ( |
15 | 103 | action, | 104 | action, |
16 | 104 | custom_widget, | ||
17 | 105 | LaunchpadEditFormView, | 105 | LaunchpadEditFormView, |
18 | 106 | LaunchpadFormView, | 106 | LaunchpadFormView, |
19 | 107 | ) | 107 | ) |
20 | @@ -1041,7 +1041,8 @@ | |||
21 | 1041 | 1041 | ||
22 | 1042 | schema = DeactivateAccountSchema | 1042 | schema = DeactivateAccountSchema |
23 | 1043 | label = "Deactivate your Launchpad account" | 1043 | label = "Deactivate your Launchpad account" |
25 | 1044 | custom_widget('comment', TextAreaWidget, height=5, width=60) | 1044 | custom_widget_comment = CustomWidgetFactory( |
26 | 1045 | TextAreaWidget, height=5, width=60) | ||
27 | 1045 | 1046 | ||
28 | 1046 | def validate(self, data): | 1047 | def validate(self, data): |
29 | 1047 | """See `LaunchpadFormView`.""" | 1048 | """See `LaunchpadFormView`.""" |
30 | @@ -1238,8 +1239,8 @@ | |||
31 | 1238 | 'personal_standing', 'personal_standing_reason', | 1239 | 'personal_standing', 'personal_standing_reason', |
32 | 1239 | 'require_strong_email_authentication', | 1240 | 'require_strong_email_authentication', |
33 | 1240 | ] | 1241 | ] |
36 | 1241 | custom_widget( | 1242 | custom_widget_personal_standing_reason = CustomWidgetFactory( |
37 | 1242 | 'personal_standing_reason', TextAreaWidget, height=5, width=60) | 1243 | TextAreaWidget, height=5, width=60) |
38 | 1243 | 1244 | ||
39 | 1244 | @property | 1245 | @property |
40 | 1245 | def is_viewing_person(self): | 1246 | def is_viewing_person(self): |
41 | @@ -1278,7 +1279,8 @@ | |||
42 | 1278 | schema = IAccountAdministerSchema | 1279 | schema = IAccountAdministerSchema |
43 | 1279 | label = "Review person's account" | 1280 | label = "Review person's account" |
44 | 1280 | field_names = ['status', 'comment'] | 1281 | field_names = ['status', 'comment'] |
46 | 1281 | custom_widget('comment', TextAreaWidget, height=5, width=60) | 1282 | custom_widget_comment = CustomWidgetFactory( |
47 | 1283 | TextAreaWidget, height=5, width=60) | ||
48 | 1282 | 1284 | ||
49 | 1283 | def __init__(self, context, request): | 1285 | def __init__(self, context, request): |
50 | 1284 | """See `LaunchpadEditFormView`.""" | 1286 | """See `LaunchpadEditFormView`.""" |
51 | @@ -1351,7 +1353,7 @@ | |||
52 | 1351 | class PersonVouchersView(LaunchpadFormView): | 1353 | class PersonVouchersView(LaunchpadFormView): |
53 | 1352 | """Form for displaying and redeeming commercial subscription vouchers.""" | 1354 | """Form for displaying and redeeming commercial subscription vouchers.""" |
54 | 1353 | 1355 | ||
56 | 1354 | custom_widget('voucher', LaunchpadDropdownWidget) | 1356 | custom_widget_voucher = LaunchpadDropdownWidget |
57 | 1355 | 1357 | ||
58 | 1356 | @property | 1358 | @property |
59 | 1357 | def page_title(self): | 1359 | def page_title(self): |
60 | @@ -2705,7 +2707,8 @@ | |||
61 | 2705 | 'hide_email_addresses', 'verbose_bugnotifications', | 2707 | 'hide_email_addresses', 'verbose_bugnotifications', |
62 | 2706 | 'selfgenerated_bugnotifications', | 2708 | 'selfgenerated_bugnotifications', |
63 | 2707 | 'expanded_notification_footers'] | 2709 | 'expanded_notification_footers'] |
65 | 2708 | custom_widget('mugshot', ImageChangeWidget, ImageChangeWidget.EDIT_STYLE) | 2710 | custom_widget_mugshot = CustomWidgetFactory( |
66 | 2711 | ImageChangeWidget, ImageChangeWidget.EDIT_STYLE) | ||
67 | 2709 | 2712 | ||
68 | 2710 | label = 'Change your personal details' | 2713 | label = 'Change your personal details' |
69 | 2711 | page_title = label | 2714 | page_title = label |
70 | @@ -2775,10 +2778,10 @@ | |||
71 | 2775 | 2778 | ||
72 | 2776 | schema = IEmailAddress | 2779 | schema = IEmailAddress |
73 | 2777 | 2780 | ||
78 | 2778 | custom_widget('VALIDATED_SELECTED', LaunchpadRadioWidget, | 2781 | custom_widget_VALIDATED_SELECTED = CustomWidgetFactory( |
79 | 2779 | orientation='vertical') | 2782 | LaunchpadRadioWidget, orientation='vertical') |
80 | 2780 | custom_widget('UNVALIDATED_SELECTED', LaunchpadRadioWidget, | 2783 | custom_widget_UNVALIDATED_SELECTED = CustomWidgetFactory( |
81 | 2781 | orientation='vertical') | 2784 | LaunchpadRadioWidget, orientation='vertical') |
82 | 2782 | 2785 | ||
83 | 2783 | label = 'Change your email settings' | 2786 | label = 'Change your email settings' |
84 | 2784 | 2787 | ||
85 | @@ -2840,8 +2843,7 @@ | |||
86 | 2840 | Choice(__name__='VALIDATED_SELECTED', | 2843 | Choice(__name__='VALIDATED_SELECTED', |
87 | 2841 | title=_('These addresses are confirmed as being yours'), | 2844 | title=_('These addresses are confirmed as being yours'), |
88 | 2842 | source=SimpleVocabulary(terms), | 2845 | source=SimpleVocabulary(terms), |
91 | 2843 | ), | 2846 | )) |
90 | 2844 | custom_widget=self.custom_widgets['VALIDATED_SELECTED']) | ||
92 | 2845 | 2847 | ||
93 | 2846 | def _unvalidated_emails_field(self): | 2848 | def _unvalidated_emails_field(self): |
94 | 2847 | """Create a field with a vocabulary of unvalidated and guessed emails. | 2849 | """Create a field with a vocabulary of unvalidated and guessed emails. |
95 | @@ -2862,8 +2864,7 @@ | |||
96 | 2862 | 2864 | ||
97 | 2863 | return FormFields( | 2865 | return FormFields( |
98 | 2864 | Choice(__name__='UNVALIDATED_SELECTED', title=title, | 2866 | Choice(__name__='UNVALIDATED_SELECTED', title=title, |
101 | 2865 | source=SimpleVocabulary(terms)), | 2867 | source=SimpleVocabulary(terms))) |
100 | 2866 | custom_widget=self.custom_widgets['UNVALIDATED_SELECTED']) | ||
102 | 2867 | 2868 | ||
103 | 2868 | def _validate_selected_address(self, data, field='VALIDATED_SELECTED'): | 2869 | def _validate_selected_address(self, data, field='VALIDATED_SELECTED'): |
104 | 2869 | """A generic validator for this view's actions. | 2870 | """A generic validator for this view's actions. |
105 | @@ -3104,8 +3105,8 @@ | |||
106 | 3104 | 3105 | ||
107 | 3105 | schema = IEmailAddress | 3106 | schema = IEmailAddress |
108 | 3106 | 3107 | ||
111 | 3107 | custom_widget('mailing_list_auto_subscribe_policy', | 3108 | custom_widget_mailing_list_auto_subscribe_policy = ( |
112 | 3108 | LaunchpadRadioWidgetWithDescription) | 3109 | LaunchpadRadioWidgetWithDescription) |
113 | 3109 | 3110 | ||
114 | 3110 | label = 'Change your mailing list subscriptions' | 3111 | label = 'Change your mailing list subscriptions' |
115 | 3111 | 3112 | ||
116 | @@ -4016,7 +4017,7 @@ | |||
117 | 4016 | 4017 | ||
118 | 4017 | schema = IEmailToPerson | 4018 | schema = IEmailToPerson |
119 | 4018 | field_names = ['subject', 'message'] | 4019 | field_names = ['subject', 'message'] |
121 | 4019 | custom_widget('subject', TextWidget, displayWidth=60) | 4020 | custom_widget_subject = CustomWidgetFactory(TextWidget, displayWidth=60) |
122 | 4020 | 4021 | ||
123 | 4021 | def initialize(self): | 4022 | def initialize(self): |
124 | 4022 | """See `ILaunchpadFormView`.""" | 4023 | """See `ILaunchpadFormView`.""" |
125 | 4023 | 4024 | ||
126 | === modified file 'lib/lp/registry/browser/poll.py' | |||
127 | --- lib/lp/registry/browser/poll.py 2016-01-26 15:47:37 +0000 | |||
128 | +++ lib/lp/registry/browser/poll.py 2018-08-31 11:41:19 +0000 | |||
129 | @@ -1,4 +1,4 @@ | |||
131 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
132 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
133 | 3 | 3 | ||
134 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
135 | @@ -21,6 +21,7 @@ | |||
136 | 21 | from z3c.ptcompat import ViewPageTemplateFile | 21 | from z3c.ptcompat import ViewPageTemplateFile |
137 | 22 | from zope.component import getUtility | 22 | from zope.component import getUtility |
138 | 23 | from zope.event import notify | 23 | from zope.event import notify |
139 | 24 | from zope.formlib.widget import CustomWidgetFactory | ||
140 | 24 | from zope.formlib.widgets import TextWidget | 25 | from zope.formlib.widgets import TextWidget |
141 | 25 | from zope.interface import ( | 26 | from zope.interface import ( |
142 | 26 | implementer, | 27 | implementer, |
143 | @@ -30,7 +31,6 @@ | |||
144 | 30 | 31 | ||
145 | 31 | from lp.app.browser.launchpadform import ( | 32 | from lp.app.browser.launchpadform import ( |
146 | 32 | action, | 33 | action, |
147 | 33 | custom_widget, | ||
148 | 34 | LaunchpadEditFormView, | 34 | LaunchpadEditFormView, |
149 | 35 | LaunchpadFormView, | 35 | LaunchpadFormView, |
150 | 36 | ) | 36 | ) |
151 | @@ -443,7 +443,7 @@ | |||
152 | 443 | label = "Edit option details" | 443 | label = "Edit option details" |
153 | 444 | page_title = 'Edit option' | 444 | page_title = 'Edit option' |
154 | 445 | field_names = ["name", "title"] | 445 | field_names = ["name", "title"] |
156 | 446 | custom_widget("title", TextWidget, displayWidth=30) | 446 | custom_widget_title = CustomWidgetFactory(TextWidget, displayWidth=30) |
157 | 447 | 447 | ||
158 | 448 | @property | 448 | @property |
159 | 449 | def cancel_url(self): | 449 | def cancel_url(self): |
160 | @@ -463,7 +463,7 @@ | |||
161 | 463 | label = "Create new poll option" | 463 | label = "Create new poll option" |
162 | 464 | page_title = "New option" | 464 | page_title = "New option" |
163 | 465 | field_names = ["name", "title"] | 465 | field_names = ["name", "title"] |
165 | 466 | custom_widget("title", TextWidget, displayWidth=30) | 466 | custom_widget_title = CustomWidgetFactory(TextWidget, displayWidth=30) |
166 | 467 | 467 | ||
167 | 468 | @property | 468 | @property |
168 | 469 | def cancel_url(self): | 469 | def cancel_url(self): |
169 | 470 | 470 | ||
170 | === modified file 'lib/lp/registry/browser/product.py' | |||
171 | --- lib/lp/registry/browser/product.py 2016-11-15 13:37:38 +0000 | |||
172 | +++ lib/lp/registry/browser/product.py 2018-08-31 11:41:19 +0000 | |||
173 | @@ -1,4 +1,4 @@ | |||
175 | 1 | # Copyright 2009-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
176 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
177 | 3 | 3 | ||
178 | 4 | """Browser views for products.""" | 4 | """Browser views for products.""" |
179 | @@ -82,7 +82,6 @@ | |||
180 | 82 | from lp.answers.browser.questiontarget import QuestionTargetTraversalMixin | 82 | from lp.answers.browser.questiontarget import QuestionTargetTraversalMixin |
181 | 83 | from lp.app.browser.launchpadform import ( | 83 | from lp.app.browser.launchpadform import ( |
182 | 84 | action, | 84 | action, |
183 | 85 | custom_widget, | ||
184 | 86 | LaunchpadEditFormView, | 85 | LaunchpadEditFormView, |
185 | 87 | LaunchpadFormView, | 86 | LaunchpadFormView, |
186 | 88 | render_radio_widget_part, | 87 | render_radio_widget_part, |
187 | @@ -1406,10 +1405,10 @@ | |||
188 | 1406 | "licenses", | 1405 | "licenses", |
189 | 1407 | "license_info", | 1406 | "license_info", |
190 | 1408 | ] | 1407 | ] |
195 | 1409 | custom_widget('licenses', LicenseWidget) | 1408 | custom_widget_licenses = LicenseWidget |
196 | 1410 | custom_widget('license_info', GhostWidget) | 1409 | custom_widget_license_info = GhostWidget |
197 | 1411 | custom_widget( | 1410 | custom_widget_information_type = CustomWidgetFactory( |
198 | 1412 | 'information_type', LaunchpadRadioWidgetWithDescription, | 1411 | LaunchpadRadioWidgetWithDescription, |
199 | 1413 | vocabulary=InformationTypeVocabulary(types=PILLAR_INFORMATION_TYPES)) | 1412 | vocabulary=InformationTypeVocabulary(types=PILLAR_INFORMATION_TYPES)) |
200 | 1414 | 1413 | ||
201 | 1415 | @property | 1414 | @property |
202 | @@ -1605,8 +1604,10 @@ | |||
203 | 1605 | 1604 | ||
204 | 1606 | schema = IProductSeries | 1605 | schema = IProductSeries |
205 | 1607 | field_names = ['name', 'summary', 'branch', 'releasefileglob'] | 1606 | field_names = ['name', 'summary', 'branch', 'releasefileglob'] |
208 | 1608 | custom_widget('summary', TextAreaWidget, height=7, width=62) | 1607 | custom_widget_summary = CustomWidgetFactory( |
209 | 1609 | custom_widget('releasefileglob', StrippedTextWidget, displayWidth=40) | 1608 | TextAreaWidget, height=7, width=62) |
210 | 1609 | custom_widget_releasefileglob = CustomWidgetFactory( | ||
211 | 1610 | StrippedTextWidget, displayWidth=40) | ||
212 | 1610 | 1611 | ||
213 | 1611 | series = None | 1612 | series = None |
214 | 1612 | 1613 | ||
215 | @@ -1765,10 +1766,10 @@ | |||
216 | 1765 | # upon creation. | 1766 | # upon creation. |
217 | 1766 | for_input = True | 1767 | for_input = True |
218 | 1767 | 1768 | ||
223 | 1768 | custom_widget('rcs_type', LaunchpadRadioWidget) | 1769 | custom_widget_rcs_type = LaunchpadRadioWidget |
224 | 1769 | custom_widget('branch_type', LaunchpadRadioWidget) | 1770 | custom_widget_branch_type = LaunchpadRadioWidget |
225 | 1770 | custom_widget('default_vcs', LaunchpadRadioWidget) | 1771 | custom_widget_default_vcs = LaunchpadRadioWidget |
226 | 1771 | custom_widget('git_repository_type', LaunchpadRadioWidget) | 1772 | custom_widget_git_repository_type = LaunchpadRadioWidget |
227 | 1772 | 1773 | ||
228 | 1773 | errors_in_action = False | 1774 | errors_in_action = False |
229 | 1774 | is_series = False | 1775 | is_series = False |
230 | @@ -2219,23 +2220,22 @@ | |||
231 | 2219 | ('subscription_modified_after', 'subscription_modified_before'), | 2220 | ('subscription_modified_after', 'subscription_modified_before'), |
232 | 2220 | ] | 2221 | ] |
233 | 2221 | 2222 | ||
251 | 2222 | custom_widget( | 2223 | custom_widget_licenses = CustomWidgetFactory( |
252 | 2223 | 'licenses', CheckBoxMatrixWidget, column_count=4, | 2224 | CheckBoxMatrixWidget, column_count=4, orientation='vertical') |
253 | 2224 | orientation='vertical') | 2225 | custom_widget_active = CustomWidgetFactory( |
254 | 2225 | custom_widget('active', LaunchpadRadioWidget, | 2226 | LaunchpadRadioWidget, _messageNoValue="(do not filter)") |
255 | 2226 | _messageNoValue="(do not filter)") | 2227 | custom_widget_project_reviewed = CustomWidgetFactory( |
256 | 2227 | custom_widget('project_reviewed', LaunchpadRadioWidget, | 2228 | LaunchpadRadioWidget, _messageNoValue="(do not filter)") |
257 | 2228 | _messageNoValue="(do not filter)") | 2229 | custom_widget_license_approved = CustomWidgetFactory( |
258 | 2229 | custom_widget('license_approved', LaunchpadRadioWidget, | 2230 | LaunchpadRadioWidget, _messageNoValue="(do not filter)") |
259 | 2230 | _messageNoValue="(do not filter)") | 2231 | custom_widget_has_subscription = CustomWidgetFactory( |
260 | 2231 | custom_widget('has_subscription', LaunchpadRadioWidget, | 2232 | LaunchpadRadioWidget, _messageNoValue="(do not filter)") |
261 | 2232 | _messageNoValue="(do not filter)") | 2233 | custom_widget_created_after = DateWidget |
262 | 2233 | custom_widget('created_after', DateWidget) | 2234 | custom_widget_created_before = DateWidget |
263 | 2234 | custom_widget('created_before', DateWidget) | 2235 | custom_widget_subscription_expires_after = DateWidget |
264 | 2235 | custom_widget('subscription_expires_after', DateWidget) | 2236 | custom_widget_subscription_expires_before = DateWidget |
265 | 2236 | custom_widget('subscription_expires_before', DateWidget) | 2237 | custom_widget_subscription_modified_after = DateWidget |
266 | 2237 | custom_widget('subscription_modified_after', DateWidget) | 2238 | custom_widget_subscription_modified_before = DateWidget |
250 | 2238 | custom_widget('subscription_modified_before', DateWidget) | ||
267 | 2239 | 2239 | ||
268 | 2240 | @property | 2240 | @property |
269 | 2241 | def left_side_widgets(self): | 2241 | def left_side_widgets(self): |
270 | @@ -2296,8 +2296,9 @@ | |||
271 | 2296 | template = ViewPageTemplateFile('../templates/product-new.pt') | 2296 | template = ViewPageTemplateFile('../templates/product-new.pt') |
272 | 2297 | page_title = "Register a project in Launchpad" | 2297 | page_title = "Register a project in Launchpad" |
273 | 2298 | 2298 | ||
276 | 2299 | custom_widget('display_name', TextWidget, displayWidth=50, label='Name') | 2299 | custom_widget_display_name = CustomWidgetFactory( |
277 | 2300 | custom_widget('name', ProductNameWidget, label='URL') | 2300 | TextWidget, displayWidth=50, label='Name') |
278 | 2301 | custom_widget_name = CustomWidgetFactory(ProductNameWidget, label='URL') | ||
279 | 2301 | 2302 | ||
280 | 2302 | step_description = 'Project basics' | 2303 | step_description = 'Project basics' |
281 | 2303 | search_results_count = 0 | 2304 | search_results_count = 0 |
282 | @@ -2355,27 +2356,28 @@ | |||
283 | 2355 | 2356 | ||
284 | 2356 | product = None | 2357 | product = None |
285 | 2357 | 2358 | ||
293 | 2358 | custom_widget('display_name', TextWidget, displayWidth=50, label='Name') | 2359 | custom_widget_display_name = CustomWidgetFactory( |
294 | 2359 | custom_widget('name', ProductNameWidget, label='URL') | 2360 | TextWidget, displayWidth=50, label='Name') |
295 | 2360 | custom_widget('homepageurl', TextWidget, displayWidth=30) | 2361 | custom_widget_name = CustomWidgetFactory(ProductNameWidget, label='URL') |
296 | 2361 | custom_widget('licenses', LicenseWidget) | 2362 | custom_widget_homepageurl = CustomWidgetFactory( |
297 | 2362 | custom_widget('license_info', GhostWidget) | 2363 | TextWidget, displayWidth=30) |
298 | 2363 | custom_widget( | 2364 | custom_widget_licenses = LicenseWidget |
299 | 2364 | 'information_type', | 2365 | custom_widget_license_info = GhostWidget |
300 | 2366 | custom_widget_information_type = CustomWidgetFactory( | ||
301 | 2365 | LaunchpadRadioWidgetWithDescription, | 2367 | LaunchpadRadioWidgetWithDescription, |
302 | 2366 | vocabulary=InformationTypeVocabulary(types=PILLAR_INFORMATION_TYPES)) | 2368 | vocabulary=InformationTypeVocabulary(types=PILLAR_INFORMATION_TYPES)) |
303 | 2367 | 2369 | ||
306 | 2368 | custom_widget( | 2370 | custom_widget_owner = CustomWidgetFactory( |
307 | 2369 | 'owner', PersonPickerWidget, header="Select the maintainer", | 2371 | PersonPickerWidget, header="Select the maintainer", |
308 | 2370 | show_create_team_link=True) | 2372 | show_create_team_link=True) |
317 | 2371 | custom_widget( | 2373 | custom_widget_bug_supervisor = CustomWidgetFactory( |
318 | 2372 | 'bug_supervisor', PersonPickerWidget, header="Set a bug supervisor", | 2374 | PersonPickerWidget, header="Set a bug supervisor", |
319 | 2373 | required=True, show_create_team_link=True) | 2375 | required=True, show_create_team_link=True) |
320 | 2374 | custom_widget( | 2376 | custom_widget_driver = CustomWidgetFactory( |
321 | 2375 | 'driver', PersonPickerWidget, header="Set a driver", | 2377 | PersonPickerWidget, header="Set a driver", |
322 | 2376 | required=True, show_create_team_link=True) | 2378 | required=True, show_create_team_link=True) |
323 | 2377 | custom_widget( | 2379 | custom_widget_disclaim_maintainer = CustomWidgetFactory( |
324 | 2378 | 'disclaim_maintainer', CheckBoxWidget, cssClass="subordinate") | 2380 | CheckBoxWidget, cssClass="subordinate") |
325 | 2379 | 2381 | ||
326 | 2380 | def initialize(self): | 2382 | def initialize(self): |
327 | 2381 | # The JSON cache must be populated before the super call, since | 2383 | # The JSON cache must be populated before the super call, since |
328 | @@ -2656,12 +2658,14 @@ | |||
329 | 2656 | # failing. | 2658 | # failing. |
330 | 2657 | initial_values = {'transfer_to_registry': False} | 2659 | initial_values = {'transfer_to_registry': False} |
331 | 2658 | 2660 | ||
338 | 2659 | custom_widget('owner', PersonPickerWidget, header="Select the maintainer", | 2661 | custom_widget_owner = CustomWidgetFactory( |
339 | 2660 | show_create_team_link=True) | 2662 | PersonPickerWidget, header="Select the maintainer", |
340 | 2661 | custom_widget('transfer_to_registry', CheckBoxWidget, | 2663 | show_create_team_link=True) |
341 | 2662 | widget_class='field subordinate') | 2664 | custom_widget_transfer_to_registry = CustomWidgetFactory( |
342 | 2663 | custom_widget('driver', PersonPickerWidget, header="Select the driver", | 2665 | CheckBoxWidget, widget_class='field subordinate') |
343 | 2664 | show_create_team_link=True) | 2666 | custom_widget_driver = CustomWidgetFactory( |
344 | 2667 | PersonPickerWidget, header="Select the driver", | ||
345 | 2668 | show_create_team_link=True) | ||
346 | 2665 | 2669 | ||
347 | 2666 | @property | 2670 | @property |
348 | 2667 | def page_title(self): | 2671 | def page_title(self): |
349 | 2668 | 2672 | ||
350 | === modified file 'lib/lp/registry/browser/productrelease.py' | |||
351 | --- lib/lp/registry/browser/productrelease.py 2015-02-01 22:42:13 +0000 | |||
352 | +++ lib/lp/registry/browser/productrelease.py 2018-08-31 11:41:19 +0000 | |||
353 | @@ -1,4 +1,4 @@ | |||
355 | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
356 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
357 | 3 | 3 | ||
358 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
359 | @@ -21,6 +21,7 @@ | |||
360 | 21 | from z3c.ptcompat import ViewPageTemplateFile | 21 | from z3c.ptcompat import ViewPageTemplateFile |
361 | 22 | from zope.event import notify | 22 | from zope.event import notify |
362 | 23 | from zope.formlib.form import FormFields | 23 | from zope.formlib.form import FormFields |
363 | 24 | from zope.formlib.widget import CustomWidgetFactory | ||
364 | 24 | from zope.formlib.widgets import ( | 25 | from zope.formlib.widgets import ( |
365 | 25 | TextAreaWidget, | 26 | TextAreaWidget, |
366 | 26 | TextWidget, | 27 | TextWidget, |
367 | @@ -35,7 +36,6 @@ | |||
368 | 35 | from lp import _ | 36 | from lp import _ |
369 | 36 | from lp.app.browser.launchpadform import ( | 37 | from lp.app.browser.launchpadform import ( |
370 | 37 | action, | 38 | action, |
371 | 38 | custom_widget, | ||
372 | 39 | LaunchpadEditFormView, | 39 | LaunchpadEditFormView, |
373 | 40 | LaunchpadFormView, | 40 | LaunchpadFormView, |
374 | 41 | ) | 41 | ) |
375 | @@ -107,9 +107,11 @@ | |||
376 | 107 | """ | 107 | """ |
377 | 108 | schema = IProductRelease | 108 | schema = IProductRelease |
378 | 109 | 109 | ||
382 | 110 | custom_widget('datereleased', DateTimeWidget) | 110 | custom_widget_datereleased = DateTimeWidget |
383 | 111 | custom_widget('release_notes', TextAreaWidget, height=7, width=62) | 111 | custom_widget_release_notes = CustomWidgetFactory( |
384 | 112 | custom_widget('changelog', TextAreaWidget, height=7, width=62) | 112 | TextAreaWidget, height=7, width=62) |
385 | 113 | custom_widget_changelog = CustomWidgetFactory( | ||
386 | 114 | TextAreaWidget, height=7, width=62) | ||
387 | 113 | 115 | ||
388 | 114 | def _prependKeepMilestoneActiveField(self): | 116 | def _prependKeepMilestoneActiveField(self): |
389 | 115 | keep_milestone_active_checkbox = FormFields( | 117 | keep_milestone_active_checkbox = FormFields( |
390 | @@ -227,9 +229,11 @@ | |||
391 | 227 | "changelog", | 229 | "changelog", |
392 | 228 | ] | 230 | ] |
393 | 229 | 231 | ||
397 | 230 | custom_widget('datereleased', DateTimeWidget) | 232 | custom_widget_datereleased = DateTimeWidget |
398 | 231 | custom_widget('release_notes', TextAreaWidget, height=7, width=62) | 233 | custom_widget_release_notes = CustomWidgetFactory( |
399 | 232 | custom_widget('changelog', TextAreaWidget, height=7, width=62) | 234 | TextAreaWidget, height=7, width=62) |
400 | 235 | custom_widget_changelog = CustomWidgetFactory( | ||
401 | 236 | TextAreaWidget, height=7, width=62) | ||
402 | 233 | 237 | ||
403 | 234 | @property | 238 | @property |
404 | 235 | def label(self): | 239 | def label(self): |
405 | @@ -265,7 +269,8 @@ | |||
406 | 265 | """A view for adding a file to an `IProductRelease`.""" | 269 | """A view for adding a file to an `IProductRelease`.""" |
407 | 266 | schema = IProductReleaseFileAddForm | 270 | schema = IProductReleaseFileAddForm |
408 | 267 | 271 | ||
410 | 268 | custom_widget('description', TextWidget, displayWidth=60) | 272 | custom_widget_description = CustomWidgetFactory( |
411 | 273 | TextWidget, displayWidth=60) | ||
412 | 269 | 274 | ||
413 | 270 | @property | 275 | @property |
414 | 271 | def label(self): | 276 | def label(self): |
415 | 272 | 277 | ||
416 | === modified file 'lib/lp/registry/browser/productseries.py' | |||
417 | --- lib/lp/registry/browser/productseries.py 2016-09-19 13:44:28 +0000 | |||
418 | +++ lib/lp/registry/browser/productseries.py 2018-08-31 11:41:19 +0000 | |||
419 | @@ -1,4 +1,4 @@ | |||
421 | 1 | # Copyright 2009-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
422 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
423 | 3 | 3 | ||
424 | 4 | """View classes for `IProductSeries`.""" | 4 | """View classes for `IProductSeries`.""" |
425 | @@ -32,6 +32,7 @@ | |||
426 | 32 | from z3c.ptcompat import ViewPageTemplateFile | 32 | from z3c.ptcompat import ViewPageTemplateFile |
427 | 33 | from zope.component import getUtility | 33 | from zope.component import getUtility |
428 | 34 | from zope.formlib import form | 34 | from zope.formlib import form |
429 | 35 | from zope.formlib.widget import CustomWidgetFactory | ||
430 | 35 | from zope.formlib.widgets import ( | 36 | from zope.formlib.widgets import ( |
431 | 36 | TextAreaWidget, | 37 | TextAreaWidget, |
432 | 37 | TextWidget, | 38 | TextWidget, |
433 | @@ -50,7 +51,6 @@ | |||
434 | 50 | from lp.app.browser.informationtype import InformationTypePortletMixin | 51 | from lp.app.browser.informationtype import InformationTypePortletMixin |
435 | 51 | from lp.app.browser.launchpadform import ( | 52 | from lp.app.browser.launchpadform import ( |
436 | 52 | action, | 53 | action, |
437 | 53 | custom_widget, | ||
438 | 54 | LaunchpadEditFormView, | 54 | LaunchpadEditFormView, |
439 | 55 | LaunchpadFormView, | 55 | LaunchpadFormView, |
440 | 56 | ) | 56 | ) |
441 | @@ -502,7 +502,7 @@ | |||
442 | 502 | return IPackaging | 502 | return IPackaging |
443 | 503 | 503 | ||
444 | 504 | field_names = ['sourcepackagename', 'distroseries'] | 504 | field_names = ['sourcepackagename', 'distroseries'] |
446 | 505 | custom_widget('sourcepackagename', UbuntuSourcePackageNameWidget) | 505 | custom_widget_sourcepackagename = UbuntuSourcePackageNameWidget |
447 | 506 | page_title = 'Ubuntu source packaging' | 506 | page_title = 'Ubuntu source packaging' |
448 | 507 | label = page_title | 507 | label = page_title |
449 | 508 | 508 | ||
450 | @@ -636,8 +636,10 @@ | |||
451 | 636 | schema = IProductSeries | 636 | schema = IProductSeries |
452 | 637 | field_names = [ | 637 | field_names = [ |
453 | 638 | 'name', 'summary', 'status', 'branch', 'releasefileglob'] | 638 | 'name', 'summary', 'status', 'branch', 'releasefileglob'] |
456 | 639 | custom_widget('summary', TextAreaWidget, height=7, width=62) | 639 | custom_widget_summary = CustomWidgetFactory( |
457 | 640 | custom_widget('releasefileglob', StrippedTextWidget, displayWidth=40) | 640 | TextAreaWidget, height=7, width=62) |
458 | 641 | custom_widget_releasefileglob = CustomWidgetFactory( | ||
459 | 642 | StrippedTextWidget, displayWidth=40) | ||
460 | 641 | 643 | ||
461 | 642 | @property | 644 | @property |
462 | 643 | def label(self): | 645 | def label(self): |
463 | @@ -797,7 +799,7 @@ | |||
464 | 797 | """A view to review and change the series `IProduct` and name.""" | 799 | """A view to review and change the series `IProduct` and name.""" |
465 | 798 | schema = IProductSeries | 800 | schema = IProductSeries |
466 | 799 | field_names = ['product', 'name'] | 801 | field_names = ['product', 'name'] |
468 | 800 | custom_widget('name', TextWidget, displayWidth=20) | 802 | custom_widget_name = CustomWidgetFactory(TextWidget, displayWidth=20) |
469 | 801 | 803 | ||
470 | 802 | @property | 804 | @property |
471 | 803 | def label(self): | 805 | def label(self): |
472 | 804 | 806 | ||
473 | === modified file 'lib/lp/registry/browser/project.py' | |||
474 | --- lib/lp/registry/browser/project.py 2015-10-01 17:32:41 +0000 | |||
475 | +++ lib/lp/registry/browser/project.py 2018-08-31 11:41:19 +0000 | |||
476 | @@ -1,4 +1,4 @@ | |||
478 | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
479 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
480 | 3 | 3 | ||
481 | 4 | """Project-related View Classes""" | 4 | """Project-related View Classes""" |
482 | @@ -35,6 +35,7 @@ | |||
483 | 35 | from zope.component import getUtility | 35 | from zope.component import getUtility |
484 | 36 | from zope.event import notify | 36 | from zope.event import notify |
485 | 37 | from zope.formlib import form | 37 | from zope.formlib import form |
486 | 38 | from zope.formlib.widget import CustomWidgetFactory | ||
487 | 38 | from zope.formlib.widgets import TextWidget | 39 | from zope.formlib.widgets import TextWidget |
488 | 39 | from zope.interface import ( | 40 | from zope.interface import ( |
489 | 40 | implementer, | 41 | implementer, |
490 | @@ -48,7 +49,6 @@ | |||
491 | 48 | from lp.answers.browser.questiontarget import QuestionCollectionAnswersMenu | 49 | from lp.answers.browser.questiontarget import QuestionCollectionAnswersMenu |
492 | 49 | from lp.app.browser.launchpadform import ( | 50 | from lp.app.browser.launchpadform import ( |
493 | 50 | action, | 51 | action, |
494 | 51 | custom_widget, | ||
495 | 52 | LaunchpadEditFormView, | 52 | LaunchpadEditFormView, |
496 | 53 | LaunchpadFormView, | 53 | LaunchpadFormView, |
497 | 54 | ) | 54 | ) |
498 | @@ -585,7 +585,8 @@ | |||
499 | 585 | 'owner', | 585 | 'owner', |
500 | 586 | 'homepageurl', | 586 | 'homepageurl', |
501 | 587 | ] | 587 | ] |
503 | 588 | custom_widget('homepageurl', TextWidget, displayWidth=30) | 588 | custom_widget_homepageurl = CustomWidgetFactory( |
504 | 589 | TextWidget, displayWidth=30) | ||
505 | 589 | label = _('Register a project group with Launchpad') | 590 | label = _('Register a project group with Launchpad') |
506 | 590 | page_title = label | 591 | page_title = label |
507 | 591 | projectgroup = None | 592 | projectgroup = None |
508 | 592 | 593 | ||
509 | === modified file 'lib/lp/registry/browser/sourcepackage.py' | |||
510 | --- lib/lp/registry/browser/sourcepackage.py 2016-02-05 15:16:29 +0000 | |||
511 | +++ lib/lp/registry/browser/sourcepackage.py 2018-08-31 11:41:19 +0000 | |||
512 | @@ -1,4 +1,4 @@ | |||
514 | 1 | # Copyright 2009-2012 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
515 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
516 | 3 | 3 | ||
517 | 4 | """Browser views for sourcepackages.""" | 4 | """Browser views for sourcepackages.""" |
518 | @@ -37,6 +37,7 @@ | |||
519 | 37 | ) | 37 | ) |
520 | 38 | from zope.formlib.form import Fields | 38 | from zope.formlib.form import Fields |
521 | 39 | from zope.formlib.interfaces import IInputWidget | 39 | from zope.formlib.interfaces import IInputWidget |
522 | 40 | from zope.formlib.widget import CustomWidgetFactory | ||
523 | 40 | from zope.formlib.widgets import DropdownWidget | 41 | from zope.formlib.widgets import DropdownWidget |
524 | 41 | from zope.interface import Interface | 42 | from zope.interface import Interface |
525 | 42 | from zope.schema import ( | 43 | from zope.schema import ( |
526 | @@ -52,7 +53,6 @@ | |||
527 | 52 | from lp import _ | 53 | from lp import _ |
528 | 53 | from lp.app.browser.launchpadform import ( | 54 | from lp.app.browser.launchpadform import ( |
529 | 54 | action, | 55 | action, |
530 | 55 | custom_widget, | ||
531 | 56 | LaunchpadFormView, | 56 | LaunchpadFormView, |
532 | 57 | ReturnToReferrerMixin, | 57 | ReturnToReferrerMixin, |
533 | 58 | ) | 58 | ) |
534 | @@ -316,8 +316,8 @@ | |||
535 | 316 | # The DropdownWidget is used, since the VocabularyPickerWidget | 316 | # The DropdownWidget is used, since the VocabularyPickerWidget |
536 | 317 | # does not support visible=False to turn it into a hidden input | 317 | # does not support visible=False to turn it into a hidden input |
537 | 318 | # to continue passing the variable in the form. | 318 | # to continue passing the variable in the form. |
540 | 319 | custom_widget('product', DropdownWidget, visible=False) | 319 | custom_widget_product = CustomWidgetFactory(DropdownWidget, visible=False) |
541 | 320 | custom_widget('productseries', LaunchpadRadioWidget) | 320 | custom_widget_productseries = LaunchpadRadioWidget |
542 | 321 | 321 | ||
543 | 322 | def setUpFields(self): | 322 | def setUpFields(self): |
544 | 323 | super(SourcePackageChangeUpstreamStepTwo, self).setUpFields() | 323 | super(SourcePackageChangeUpstreamStepTwo, self).setUpFields() |
545 | @@ -556,8 +556,8 @@ | |||
546 | 556 | """A view for linking to an upstream package.""" | 556 | """A view for linking to an upstream package.""" |
547 | 557 | 557 | ||
548 | 558 | schema = Interface | 558 | schema = Interface |
551 | 559 | custom_widget( | 559 | custom_widget_upstream = CustomWidgetFactory( |
552 | 560 | 'upstream', LaunchpadRadioWidget, orientation='vertical') | 560 | LaunchpadRadioWidget, orientation='vertical') |
553 | 561 | product_suggestions = None | 561 | product_suggestions = None |
554 | 562 | initial_focus_widget = None | 562 | initial_focus_widget = None |
555 | 563 | max_suggestions = 9 | 563 | max_suggestions = 9 |
556 | 564 | 564 | ||
557 | === modified file 'lib/lp/registry/browser/team.py' | |||
558 | --- lib/lp/registry/browser/team.py 2016-11-15 17:49:49 +0000 | |||
559 | +++ lib/lp/registry/browser/team.py 2018-08-31 11:41:19 +0000 | |||
560 | @@ -1,4 +1,4 @@ | |||
562 | 1 | # Copyright 2009-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
563 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
564 | 3 | 3 | ||
565 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
566 | @@ -52,6 +52,7 @@ | |||
567 | 52 | FormFields, | 52 | FormFields, |
568 | 53 | ) | 53 | ) |
569 | 54 | from zope.formlib.textwidgets import IntWidget | 54 | from zope.formlib.textwidgets import IntWidget |
570 | 55 | from zope.formlib.widget import CustomWidgetFactory | ||
571 | 55 | from zope.formlib.widgets import TextAreaWidget | 56 | from zope.formlib.widgets import TextAreaWidget |
572 | 56 | from zope.interface import ( | 57 | from zope.interface import ( |
573 | 57 | classImplements, | 58 | classImplements, |
574 | @@ -76,7 +77,6 @@ | |||
575 | 76 | from lp.app.browser.badge import HasBadgeBase | 77 | from lp.app.browser.badge import HasBadgeBase |
576 | 77 | from lp.app.browser.launchpadform import ( | 78 | from lp.app.browser.launchpadform import ( |
577 | 78 | action, | 79 | action, |
578 | 79 | custom_widget, | ||
579 | 80 | LaunchpadFormView, | 80 | LaunchpadFormView, |
580 | 81 | ) | 81 | ) |
581 | 82 | from lp.app.browser.tales import PersonFormatterAPI | 82 | from lp.app.browser.tales import PersonFormatterAPI |
582 | @@ -299,14 +299,14 @@ | |||
583 | 299 | 299 | ||
584 | 300 | page_title = label | 300 | page_title = label |
585 | 301 | 301 | ||
594 | 302 | custom_widget( | 302 | custom_widget_renewal_policy = CustomWidgetFactory( |
595 | 303 | 'renewal_policy', LaunchpadRadioWidget, orientation='vertical') | 303 | LaunchpadRadioWidget, orientation='vertical') |
596 | 304 | custom_widget('defaultrenewalperiod', IntWidget, | 304 | custom_widget_defaultrenewalperiod = CustomWidgetFactory( |
597 | 305 | widget_class='field subordinate') | 305 | IntWidget, widget_class='field subordinate') |
598 | 306 | custom_widget( | 306 | custom_widget_membership_policy = CustomWidgetFactory( |
599 | 307 | 'membership_policy', LaunchpadRadioWidgetWithDescription, | 307 | LaunchpadRadioWidgetWithDescription, orientation='vertical') |
600 | 308 | orientation='vertical') | 308 | custom_widget_description = CustomWidgetFactory( |
601 | 309 | custom_widget('description', TextAreaWidget, height=10, width=30) | 309 | TextAreaWidget, height=10, width=30) |
602 | 310 | 310 | ||
603 | 311 | def setUpFields(self): | 311 | def setUpFields(self): |
604 | 312 | """See `LaunchpadViewForm`.""" | 312 | """See `LaunchpadViewForm`.""" |
605 | @@ -442,8 +442,8 @@ | |||
606 | 442 | 442 | ||
607 | 443 | schema = ITeamContactAddressForm | 443 | schema = ITeamContactAddressForm |
608 | 444 | 444 | ||
611 | 445 | custom_widget( | 445 | custom_widget_contact_method = CustomWidgetFactory( |
612 | 446 | 'contact_method', LaunchpadRadioWidget, orientation='vertical') | 446 | LaunchpadRadioWidget, orientation='vertical') |
613 | 447 | 447 | ||
614 | 448 | @property | 448 | @property |
615 | 449 | def label(self): | 449 | def label(self): |
616 | @@ -603,7 +603,8 @@ | |||
617 | 603 | schema = IMailingList | 603 | schema = IMailingList |
618 | 604 | field_names = ['welcome_message'] | 604 | field_names = ['welcome_message'] |
619 | 605 | label = "Mailing list configuration" | 605 | label = "Mailing list configuration" |
621 | 606 | custom_widget('welcome_message', TextAreaWidget, width=72, height=10) | 606 | custom_widget_welcome_message = CustomWidgetFactory( |
622 | 607 | TextAreaWidget, width=72, height=10) | ||
623 | 607 | page_title = label | 608 | page_title = label |
624 | 608 | 609 | ||
625 | 609 | def __init__(self, context, request): | 610 | def __init__(self, context, request): |
626 | @@ -1001,14 +1002,13 @@ | |||
627 | 1001 | page_title = 'Register a new team in Launchpad' | 1002 | page_title = 'Register a new team in Launchpad' |
628 | 1002 | label = page_title | 1003 | label = page_title |
629 | 1003 | 1004 | ||
638 | 1004 | custom_widget('teamowner', HiddenUserWidget) | 1005 | custom_widget_teamowner = HiddenUserWidget |
639 | 1005 | custom_widget( | 1006 | custom_widget_renewal_policy = CustomWidgetFactory( |
640 | 1006 | 'renewal_policy', LaunchpadRadioWidget, orientation='vertical') | 1007 | LaunchpadRadioWidget, orientation='vertical') |
641 | 1007 | custom_widget( | 1008 | custom_widget_membership_policy = CustomWidgetFactory( |
642 | 1008 | 'membership_policy', LaunchpadRadioWidgetWithDescription, | 1009 | LaunchpadRadioWidgetWithDescription, orientation='vertical') |
643 | 1009 | orientation='vertical') | 1010 | custom_widget_defaultrenewalperiod = CustomWidgetFactory( |
644 | 1010 | custom_widget('defaultrenewalperiod', IntWidget, | 1011 | IntWidget, widget_class='field subordinate') |
637 | 1011 | widget_class='field subordinate') | ||
645 | 1012 | 1012 | ||
646 | 1013 | def setUpFields(self): | 1013 | def setUpFields(self): |
647 | 1014 | """See `LaunchpadViewForm`. | 1014 | """See `LaunchpadViewForm`. |
648 | @@ -1073,9 +1073,8 @@ | |||
649 | 1073 | 1073 | ||
650 | 1074 | # Use a dropdown - Javascript will be used to change this to a choice | 1074 | # Use a dropdown - Javascript will be used to change this to a choice |
651 | 1075 | # popup widget. | 1075 | # popup widget. |
655 | 1076 | custom_widget( | 1076 | custom_widget_membership_policy = CustomWidgetFactory( |
656 | 1077 | 'membership_policy', LaunchpadDropdownWidget, | 1077 | LaunchpadDropdownWidget, orientation='vertical') |
654 | 1078 | orientation='vertical') | ||
657 | 1079 | 1078 | ||
658 | 1080 | 1079 | ||
659 | 1081 | class ProposedTeamMembersEditView(LaunchpadFormView): | 1080 | class ProposedTeamMembersEditView(LaunchpadFormView): |
660 | @@ -1164,8 +1163,8 @@ | |||
661 | 1164 | # below should be changed to the more appropriate False bool when we're | 1163 | # below should be changed to the more appropriate False bool when we're |
662 | 1165 | # making use of the JSON cache to setup pickers, rather than assembling | 1164 | # making use of the JSON cache to setup pickers, rather than assembling |
663 | 1166 | # javascript in a view macro. | 1165 | # javascript in a view macro. |
666 | 1167 | custom_widget( | 1166 | custom_widget_newmember = CustomWidgetFactory( |
667 | 1168 | 'newmember', PersonPickerWidget, | 1167 | PersonPickerWidget, |
668 | 1169 | show_assign_me_button='false', show_remove_button='false') | 1168 | show_assign_me_button='false', show_remove_button='false') |
669 | 1170 | 1169 | ||
670 | 1171 | @property | 1170 | @property |
671 | @@ -1362,7 +1361,8 @@ | |||
672 | 1362 | __name__ = '+invitation' | 1361 | __name__ = '+invitation' |
673 | 1363 | schema = ITeamMembershipInvitationAcknowledgementForm | 1362 | schema = ITeamMembershipInvitationAcknowledgementForm |
674 | 1364 | field_names = ['acknowledger_comment'] | 1363 | field_names = ['acknowledger_comment'] |
676 | 1365 | custom_widget('acknowledger_comment', TextAreaWidget, height=5, width=60) | 1364 | custom_widget_acknowledger_comment = CustomWidgetFactory( |
677 | 1365 | TextAreaWidget, height=5, width=60) | ||
678 | 1366 | template = ViewPageTemplateFile( | 1366 | template = ViewPageTemplateFile( |
679 | 1367 | '../templates/teammembership-invitation.pt') | 1367 | '../templates/teammembership-invitation.pt') |
680 | 1368 | 1368 | ||
681 | @@ -1893,7 +1893,7 @@ | |||
682 | 1893 | """Propose/add to this team any team that you're an administrator of.""" | 1893 | """Propose/add to this team any team that you're an administrator of.""" |
683 | 1894 | 1894 | ||
684 | 1895 | page_title = 'Propose/add one of your teams to another one' | 1895 | page_title = 'Propose/add one of your teams to another one' |
686 | 1896 | custom_widget('teams', LabeledMultiCheckBoxWidget) | 1896 | custom_widget_teams = LabeledMultiCheckBoxWidget |
687 | 1897 | 1897 | ||
688 | 1898 | def initialize(self): | 1898 | def initialize(self): |
689 | 1899 | context = self.context | 1899 | context = self.context |
690 | 1900 | 1900 | ||
691 | === modified file 'lib/lp/registry/doc/product-widgets.txt' | |||
692 | --- lib/lp/registry/doc/product-widgets.txt 2017-10-21 18:14:14 +0000 | |||
693 | +++ lib/lp/registry/doc/product-widgets.txt 2018-08-31 11:41:19 +0000 | |||
694 | @@ -403,8 +403,7 @@ | |||
695 | 403 | 403 | ||
696 | 404 | >>> from lp.services.config import config | 404 | >>> from lp.services.config import config |
697 | 405 | >>> from z3c.ptcompat import ViewPageTemplateFile | 405 | >>> from z3c.ptcompat import ViewPageTemplateFile |
700 | 406 | >>> from lp.app.browser.launchpadform import ( | 406 | >>> from lp.app.browser.launchpadform import LaunchpadFormView |
699 | 407 | ... custom_widget, LaunchpadFormView) | ||
701 | 408 | 407 | ||
702 | 409 | >>> class GhostWidgetView(LaunchpadFormView): | 408 | >>> class GhostWidgetView(LaunchpadFormView): |
703 | 410 | ... page_title = 'Test' | 409 | ... page_title = 'Test' |
704 | @@ -412,7 +411,7 @@ | |||
705 | 412 | ... config.root + '/lib/lp/app/templates/generic-edit.pt') | 411 | ... config.root + '/lib/lp/app/templates/generic-edit.pt') |
706 | 413 | ... schema = IProduct | 412 | ... schema = IProduct |
707 | 414 | ... field_names = ['license_info'] | 413 | ... field_names = ['license_info'] |
709 | 415 | ... custom_widget('license_info', GhostWidget) | 414 | ... custom_widget_license_info = GhostWidget |
710 | 416 | 415 | ||
711 | 417 | >>> request = LaunchpadTestRequest() | 416 | >>> request = LaunchpadTestRequest() |
712 | 418 | >>> request.setPrincipal(factory.makePerson()) | 417 | >>> request.setPrincipal(factory.makePerson()) |