Merge lp:~michael.nelson/launchpad/429263-no-value-option into lp:launchpad
- 429263-no-value-option
- Merge into devel
Proposed by
Michael Nelson
Status: | Merged |
---|---|
Approved by: | Graham Binns |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp:~michael.nelson/launchpad/429263-no-value-option |
Merge into: | lp:launchpad |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~michael.nelson/launchpad/429263-no-value-option |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Graham Binns (community) | Approve | ||
Review via email: mp+11768@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote : | # |
Revision history for this message
Graham Binns (gmb) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/soyuz/browser/archive.py' | |||
2 | --- lib/lp/soyuz/browser/archive.py 2009-09-11 17:55:23 +0000 | |||
3 | +++ lib/lp/soyuz/browser/archive.py 2009-09-15 08:25:32 +0000 | |||
4 | @@ -577,7 +577,7 @@ | |||
5 | 577 | this factory can only be used in a class where the context is | 577 | this factory can only be used in a class where the context is |
6 | 578 | an IArchive. | 578 | an IArchive. |
7 | 579 | """ | 579 | """ |
9 | 580 | series_terms = [SimpleTerm(None, token='any', title='Any Series')] | 580 | series_terms = [] |
10 | 581 | for distroseries in context.series_with_sources: | 581 | for distroseries in context.series_with_sources: |
11 | 582 | series_terms.append( | 582 | series_terms.append( |
12 | 583 | SimpleTerm(distroseries, token=distroseries.name, | 583 | SimpleTerm(distroseries, token=distroseries.name, |
13 | @@ -585,6 +585,16 @@ | |||
14 | 585 | return SimpleVocabulary(series_terms) | 585 | return SimpleVocabulary(series_terms) |
15 | 586 | 586 | ||
16 | 587 | 587 | ||
17 | 588 | class SeriesFilterWidget(LaunchpadDropdownWidget): | ||
18 | 589 | """Redefining default display value as 'Any series'.""" | ||
19 | 590 | _messageNoValue = _("any", "Any series") | ||
20 | 591 | |||
21 | 592 | |||
22 | 593 | class StatusFilterWidget(LaunchpadDropdownWidget): | ||
23 | 594 | """Redefining default display value as 'Any status'.""" | ||
24 | 595 | _messageNoValue = _("any", "Any status") | ||
25 | 596 | |||
26 | 597 | |||
27 | 588 | class IPPAPackageFilter(Interface): | 598 | class IPPAPackageFilter(Interface): |
28 | 589 | """The interface used as the schema for the package filtering form.""" | 599 | """The interface used as the schema for the package filtering form.""" |
29 | 590 | name_filter = TextLine( | 600 | name_filter = TextLine( |
30 | @@ -596,7 +606,6 @@ | |||
31 | 596 | status_filter = Choice(vocabulary=SimpleVocabulary(( | 606 | status_filter = Choice(vocabulary=SimpleVocabulary(( |
32 | 597 | SimpleTerm(active_publishing_status, 'published', 'Published'), | 607 | SimpleTerm(active_publishing_status, 'published', 'Published'), |
33 | 598 | SimpleTerm(inactive_publishing_status, 'superseded', 'Superseded'), | 608 | SimpleTerm(inactive_publishing_status, 'superseded', 'Superseded'), |
34 | 599 | SimpleTerm(None, 'any', 'Any status') | ||
35 | 600 | )), required=False) | 609 | )), required=False) |
36 | 601 | 610 | ||
37 | 602 | 611 | ||
38 | @@ -604,6 +613,8 @@ | |||
39 | 604 | """A Form view for filtering and batching source packages.""" | 613 | """A Form view for filtering and batching source packages.""" |
40 | 605 | 614 | ||
41 | 606 | schema = IPPAPackageFilter | 615 | schema = IPPAPackageFilter |
42 | 616 | custom_widget('series_filter', SeriesFilterWidget) | ||
43 | 617 | custom_widget('status_filter', StatusFilterWidget) | ||
44 | 607 | 618 | ||
45 | 608 | # By default this view will not display the sources with selectable | 619 | # By default this view will not display the sources with selectable |
46 | 609 | # checkboxes, but subclasses can override as needed. | 620 | # checkboxes, but subclasses can override as needed. |
47 | @@ -625,65 +636,52 @@ | |||
48 | 625 | else: | 636 | else: |
49 | 626 | return None | 637 | return None |
50 | 627 | 638 | ||
70 | 628 | @cachedproperty | 639 | def getSelectedFilterValue(self, filter_name): |
71 | 629 | def selected_status_filter(self): | 640 | """Return the selected filter or the default, given a filter name. |
72 | 630 | """Return the selected status filter or the default.""" | 641 | |
73 | 631 | requested_status_filter = self.request.query_string_params.get( | 642 | This is needed because zope's form library does not consider |
74 | 632 | 'field.status_filter') | 643 | query string params (GET params) during a post request. |
75 | 633 | 644 | """ | |
76 | 634 | # If the request included a status filter, try to use it: | 645 | field_name = 'field.' + filter_name |
77 | 635 | selected_status_filter = None | 646 | requested_filter = self.request.query_string_params.get(field_name) |
78 | 636 | if requested_status_filter is not None: | 647 | |
79 | 637 | selected_status_filter = ( | 648 | # If an empty filter was specified, then it's explicitly |
80 | 638 | self.widgets['status_filter'].vocabulary.getTermByToken( | 649 | # been set to empty - so we use None. |
81 | 639 | requested_status_filter[0])) | 650 | if requested_filter == ['']: |
82 | 640 | 651 | return None | |
83 | 641 | # If the request didn't include a status, or it was invalid, use | 652 | |
84 | 642 | # the default: | 653 | # If the requested filter is none, then we use the default. |
85 | 643 | if selected_status_filter is None: | 654 | default_filter_attr = 'default_' + filter_name |
86 | 644 | selected_status_filter = self.default_status_filter | 655 | if requested_filter is None: |
87 | 645 | 656 | return getattr(self, default_filter_attr) | |
88 | 646 | return selected_status_filter | 657 | |
89 | 658 | # If the request included a filter, try to use it - if it's | ||
90 | 659 | # invalid we use the default instead. | ||
91 | 660 | vocab = self.widgets[filter_name].vocabulary | ||
92 | 661 | if vocab.by_token.has_key(requested_filter[0]): | ||
93 | 662 | return vocab.getTermByToken(requested_filter[0]).value | ||
94 | 663 | else: | ||
95 | 664 | return getattr(self, default_filter_attr) | ||
96 | 647 | 665 | ||
97 | 648 | @property | 666 | @property |
98 | 649 | def plain_status_filter_widget(self): | 667 | def plain_status_filter_widget(self): |
99 | 650 | """Render a <select> control with no <div>s around it.""" | 668 | """Render a <select> control with no <div>s around it.""" |
100 | 651 | return self.widgets['status_filter'].renderValue( | 669 | return self.widgets['status_filter'].renderValue( |
122 | 652 | self.selected_status_filter.value) | 670 | self.getSelectedFilterValue('status_filter')) |
102 | 653 | |||
103 | 654 | @property | ||
104 | 655 | def selected_series_filter(self): | ||
105 | 656 | """Return the currently selected filter or None.""" | ||
106 | 657 | requested_series_filter = self.request.query_string_params.get( | ||
107 | 658 | 'field.series_filter') | ||
108 | 659 | |||
109 | 660 | # If the request included a series filter, try to use it: | ||
110 | 661 | selected_series_filter = None | ||
111 | 662 | if requested_series_filter is not None: | ||
112 | 663 | series_vocabulary = self.widgets['series_filter'].vocabulary | ||
113 | 664 | selected_series_filter = series_vocabulary.getTermByToken( | ||
114 | 665 | requested_series_filter[0]) | ||
115 | 666 | |||
116 | 667 | # If the request didn't include a series, or it was invalid, use | ||
117 | 668 | # the default: | ||
118 | 669 | if selected_series_filter is None: | ||
119 | 670 | selected_series_filter = self.default_series_filter | ||
120 | 671 | |||
121 | 672 | return selected_series_filter | ||
123 | 673 | 671 | ||
124 | 674 | @property | 672 | @property |
125 | 675 | def plain_series_filter_widget(self): | 673 | def plain_series_filter_widget(self): |
126 | 676 | """Render a <select> control with no <div>s around it.""" | 674 | """Render a <select> control with no <div>s around it.""" |
127 | 677 | return self.widgets['series_filter'].renderValue( | 675 | return self.widgets['series_filter'].renderValue( |
129 | 678 | self.selected_series_filter.value) | 676 | self.getSelectedFilterValue('series_filter')) |
130 | 679 | 677 | ||
131 | 680 | @property | 678 | @property |
132 | 681 | def filtered_sources(self): | 679 | def filtered_sources(self): |
133 | 682 | """Return the source results for display after filtering.""" | 680 | """Return the source results for display after filtering.""" |
134 | 683 | return self.context.getPublishedSources( | 681 | return self.context.getPublishedSources( |
135 | 684 | name=self.specified_name_filter, | 682 | name=self.specified_name_filter, |
138 | 685 | status=self.selected_status_filter.value, | 683 | status=self.getSelectedFilterValue('status_filter'), |
139 | 686 | distroseries=self.selected_series_filter.value) | 684 | distroseries=self.getSelectedFilterValue('series_filter')) |
140 | 687 | 685 | ||
141 | 688 | @property | 686 | @property |
142 | 689 | def default_status_filter(self): | 687 | def default_status_filter(self): |
143 | @@ -692,7 +690,7 @@ | |||
144 | 692 | Subclasses of ArchiveViewBase can override this when required. | 690 | Subclasses of ArchiveViewBase can override this when required. |
145 | 693 | """ | 691 | """ |
146 | 694 | return self.widgets['status_filter'].vocabulary.getTermByToken( | 692 | return self.widgets['status_filter'].vocabulary.getTermByToken( |
148 | 695 | 'published') | 693 | 'published').value |
149 | 696 | 694 | ||
150 | 697 | @property | 695 | @property |
151 | 698 | def default_series_filter(self): | 696 | def default_series_filter(self): |
152 | @@ -700,7 +698,7 @@ | |||
153 | 700 | 698 | ||
154 | 701 | Subclasses of ArchiveViewBase can override this when required. | 699 | Subclasses of ArchiveViewBase can override this when required. |
155 | 702 | """ | 700 | """ |
157 | 703 | return self.widgets['series_filter'].vocabulary.getTermByToken('any') | 701 | return None |
158 | 704 | 702 | ||
159 | 705 | @cachedproperty | 703 | @cachedproperty |
160 | 706 | def batchnav(self): | 704 | def batchnav(self): |
161 | @@ -769,10 +767,10 @@ | |||
162 | 769 | for term in vocabulary: | 767 | for term in vocabulary: |
163 | 770 | if (term.value is not None and | 768 | if (term.value is not None and |
164 | 771 | term.value.version == version_number): | 769 | term.value.version == version_number): |
166 | 772 | return term | 770 | return term.value |
167 | 773 | 771 | ||
168 | 774 | # Otherwise we default to 'any' | 772 | # Otherwise we default to 'any' |
170 | 775 | return vocabulary.getTermByToken('any') | 773 | return None |
171 | 776 | 774 | ||
172 | 777 | @property | 775 | @property |
173 | 778 | def archive_description_html(self): | 776 | def archive_description_html(self): |
174 | @@ -990,7 +988,7 @@ | |||
175 | 990 | @property | 988 | @property |
176 | 991 | def default_status_filter(self): | 989 | def default_status_filter(self): |
177 | 992 | """Present records in any status by default.""" | 990 | """Present records in any status by default.""" |
179 | 993 | return self.widgets['status_filter'].vocabulary.getTermByToken('any') | 991 | return None |
180 | 994 | 992 | ||
181 | 995 | @cachedproperty | 993 | @cachedproperty |
182 | 996 | def filtered_sources(self): | 994 | def filtered_sources(self): |
183 | @@ -998,14 +996,11 @@ | |||
184 | 998 | 996 | ||
185 | 999 | This overrides ArchiveViewBase.filtered_sources to use a | 997 | This overrides ArchiveViewBase.filtered_sources to use a |
186 | 1000 | different method on the context specific to deletion records. | 998 | different method on the context specific to deletion records. |
187 | 1001 | |||
188 | 1002 | It expects 'self.selected_status_filter' and | ||
189 | 1003 | 'self.selected_series_filter' to be set. | ||
190 | 1004 | """ | 999 | """ |
191 | 1005 | return self.context.getSourcesForDeletion( | 1000 | return self.context.getSourcesForDeletion( |
192 | 1006 | name=self.specified_name_filter, | 1001 | name=self.specified_name_filter, |
195 | 1007 | status=self.selected_status_filter.value, | 1002 | status=self.getSelectedFilterValue('status_filter'), |
196 | 1008 | distroseries=self.selected_series_filter.value) | 1003 | distroseries=self.getSelectedFilterValue('series_filter')) |
197 | 1009 | 1004 | ||
198 | 1010 | @cachedproperty | 1005 | @cachedproperty |
199 | 1011 | def has_sources(self): | 1006 | def has_sources(self): |
200 | @@ -1093,7 +1088,7 @@ | |||
201 | 1093 | def default_status_filter(self): | 1088 | def default_status_filter(self): |
202 | 1094 | """Present published records by default.""" | 1089 | """Present published records by default.""" |
203 | 1095 | return self.widgets['status_filter'].vocabulary.getTermByToken( | 1090 | return self.widgets['status_filter'].vocabulary.getTermByToken( |
205 | 1096 | 'published') | 1091 | 'published').value |
206 | 1097 | 1092 | ||
207 | 1098 | def setUpFields(self): | 1093 | def setUpFields(self): |
208 | 1099 | """Override `ArchiveSourceSelectionFormView`. | 1094 | """Override `ArchiveSourceSelectionFormView`. |
209 | 1100 | 1095 | ||
210 | === modified file 'lib/lp/soyuz/browser/tests/archive-views.txt' | |||
211 | --- lib/lp/soyuz/browser/tests/archive-views.txt 2009-09-11 17:55:23 +0000 | |||
212 | +++ lib/lp/soyuz/browser/tests/archive-views.txt 2009-09-15 08:25:32 +0000 | |||
213 | @@ -90,14 +90,12 @@ | |||
214 | 90 | ... print term.title | 90 | ... print term.title |
215 | 91 | Published | 91 | Published |
216 | 92 | Superseded | 92 | Superseded |
217 | 93 | Any status | ||
218 | 94 | 93 | ||
219 | 95 | An ArchiveView inherits the series-filter widget for filtering packages | 94 | An ArchiveView inherits the series-filter widget for filtering packages |
220 | 96 | by series. | 95 | by series. |
221 | 97 | 96 | ||
222 | 98 | >>> for term in ppa_archive_view.widgets['series_filter'].vocabulary: | 97 | >>> for term in ppa_archive_view.widgets['series_filter'].vocabulary: |
223 | 99 | ... print term.title | 98 | ... print term.title |
224 | 100 | Any Series | ||
225 | 101 | Breezy Badger Autotest | 99 | Breezy Badger Autotest |
226 | 102 | Warty | 100 | Warty |
227 | 103 | 101 | ||
228 | @@ -406,8 +404,8 @@ | |||
229 | 406 | The archive index view overrides the default series filter to use the | 404 | The archive index view overrides the default series filter to use the |
230 | 407 | distroseries from the browser's user-agent, when applicable. | 405 | distroseries from the browser's user-agent, when applicable. |
231 | 408 | 406 | ||
234 | 409 | >>> print view.default_series_filter.token | 407 | >>> print view.default_series_filter |
235 | 410 | any | 408 | None |
236 | 411 | 409 | ||
237 | 412 | >>> view_warty = create_view( | 410 | >>> view_warty = create_view( |
238 | 413 | ... cprov.archive, name="+index", | 411 | ... cprov.archive, name="+index", |
239 | @@ -416,8 +414,19 @@ | |||
240 | 416 | ... 'Gecko/2009042523 Ubuntu/4.10 (whatever) ' | 414 | ... 'Gecko/2009042523 Ubuntu/4.10 (whatever) ' |
241 | 417 | ... 'Firefox/3.0.10') | 415 | ... 'Firefox/3.0.10') |
242 | 418 | >>> view_warty.initialize() | 416 | >>> view_warty.initialize() |
245 | 419 | >>> print view_warty.default_series_filter.token | 417 | >>> print view_warty.default_series_filter.name |
246 | 420 | warty | 418 | warty |
247 | 419 | |||
248 | 420 | The archive index view also inherits the getSelectedFilterValue() method | ||
249 | 421 | which can be used to find the currently selected value for both filters. | ||
250 | 422 | |||
251 | 423 | >>> print view_warty.getSelectedFilterValue('series_filter').name | ||
252 | 424 | warty | ||
253 | 425 | |||
254 | 426 | >>> for status in view_warty.getSelectedFilterValue('status_filter'): | ||
255 | 427 | ... print status.name | ||
256 | 428 | PENDING | ||
257 | 429 | PUBLISHED | ||
258 | 421 | 430 | ||
259 | 422 | 431 | ||
260 | 423 | == ArchivePackageView == | 432 | == ArchivePackageView == |
261 | @@ -558,7 +567,6 @@ | |||
262 | 558 | ... form={ | 567 | ... form={ |
263 | 559 | ... 'field.actions.delete': 'Delete Packages', | 568 | ... 'field.actions.delete': 'Delete Packages', |
264 | 560 | ... 'field.name_filter': '', | 569 | ... 'field.name_filter': '', |
265 | 561 | ... 'field.status_filter': 'any', | ||
266 | 562 | ... 'field.deletion_comment': 'Go away', | 570 | ... 'field.deletion_comment': 'Go away', |
267 | 563 | ... 'field.selected_sources': ['27', '28', '29'], | 571 | ... 'field.selected_sources': ['27', '28', '29'], |
268 | 564 | ... 'field.selected_sources-empty-marker': 1, | 572 | ... 'field.selected_sources-empty-marker': 1, |
269 | @@ -579,7 +587,6 @@ | |||
270 | 579 | ... form={ | 587 | ... form={ |
271 | 580 | ... 'field.actions.delete': 'Delete Packages', | 588 | ... 'field.actions.delete': 'Delete Packages', |
272 | 581 | ... 'field.name_filter': '', | 589 | ... 'field.name_filter': '', |
273 | 582 | ... 'field.status_filter': 'any', | ||
274 | 583 | ... 'field.deletion_comment': 'Go away', | 590 | ... 'field.deletion_comment': 'Go away', |
275 | 584 | ... 'field.selected_sources': ['27', '28', '29'], | 591 | ... 'field.selected_sources': ['27', '28', '29'], |
276 | 585 | ... 'field.selected_sources-empty-marker': 1, | 592 | ... 'field.selected_sources-empty-marker': 1, |
277 | @@ -1009,7 +1016,7 @@ | |||
278 | 1009 | 1016 | ||
279 | 1010 | >>> view = create_initialized_view( | 1017 | >>> view = create_initialized_view( |
280 | 1011 | ... cprov.archive, name="+copy-packages", | 1018 | ... cprov.archive, name="+copy-packages", |
282 | 1012 | ... query_string="field.status_filter=any") | 1019 | ... query_string="field.status_filter=") |
283 | 1013 | 1020 | ||
284 | 1014 | >>> [pub.status.name for pub in view.batched_sources] | 1021 | >>> [pub.status.name for pub in view.batched_sources] |
285 | 1015 | ['DELETED', 'DELETED', 'DELETED'] | 1022 | ['DELETED', 'DELETED', 'DELETED'] |
286 | @@ -1289,7 +1296,6 @@ | |||
287 | 1289 | >>> view = create_initialized_view( | 1296 | >>> view = create_initialized_view( |
288 | 1290 | ... cprov.archive, name="+copy-packages", | 1297 | ... cprov.archive, name="+copy-packages", |
289 | 1291 | ... form={ | 1298 | ... form={ |
290 | 1292 | ... 'field.status_filter': 'any', | ||
291 | 1293 | ... 'field.selected_sources': [str(private_source.id)], | 1299 | ... 'field.selected_sources': [str(private_source.id)], |
292 | 1294 | ... 'field.destination_archive': 'ubuntu-team/ppa', | 1300 | ... 'field.destination_archive': 'ubuntu-team/ppa', |
293 | 1295 | ... 'field.destination_series': '', | 1301 | ... 'field.destination_series': '', |
294 | 1296 | 1302 | ||
295 | === modified file 'lib/lp/soyuz/stories/ppa/xx-copy-packages.txt' | |||
296 | --- lib/lp/soyuz/stories/ppa/xx-copy-packages.txt 2009-09-12 06:49:56 +0000 | |||
297 | +++ lib/lp/soyuz/stories/ppa/xx-copy-packages.txt 2009-09-15 08:00:26 +0000 | |||
298 | @@ -559,7 +559,7 @@ | |||
299 | 559 | really deleted. | 559 | really deleted. |
300 | 560 | 560 | ||
301 | 561 | >>> jblack_browser.getLink('Cancel').click() | 561 | >>> jblack_browser.getLink('Cancel').click() |
303 | 562 | >>> jblack_browser.getControl(name='field.status_filter').value = ['any'] | 562 | >>> jblack_browser.getControl(name='field.status_filter').value = [''] |
304 | 563 | >>> jblack_browser.getControl('Filter', index=0).click() | 563 | >>> jblack_browser.getControl('Filter', index=0).click() |
305 | 564 | >>> print_ppa_packages(jblack_browser.contents) | 564 | >>> print_ppa_packages(jblack_browser.contents) |
306 | 565 | Source Published Status Series Section Build | 565 | Source Published Status Series Section Build |
307 | @@ -587,7 +587,7 @@ | |||
308 | 587 | Packages in other status can be browsed by adjusting the status | 587 | Packages in other status can be browsed by adjusting the status |
309 | 588 | filter dropdown box. | 588 | filter dropdown box. |
310 | 589 | 589 | ||
312 | 590 | >>> jblack_browser.getControl(name='field.status_filter').value = ['any'] | 590 | >>> jblack_browser.getControl(name='field.status_filter').value = [''] |
313 | 591 | >>> jblack_browser.getControl("Filter").click() | 591 | >>> jblack_browser.getControl("Filter").click() |
314 | 592 | >>> print_ppa_packages(jblack_browser.contents) | 592 | >>> print_ppa_packages(jblack_browser.contents) |
315 | 593 | Source Published Status Series Section Build | 593 | Source Published Status Series Section Build |
316 | @@ -831,7 +831,7 @@ | |||
317 | 831 | >>> jblack_browser.open( | 831 | >>> jblack_browser.open( |
318 | 832 | ... 'http://launchpad.dev/~jblack/+archive/ppa/+packages') | 832 | ... 'http://launchpad.dev/~jblack/+archive/ppa/+packages') |
319 | 833 | >>> jblack_browser.getLink('Copy packages').click() | 833 | >>> jblack_browser.getLink('Copy packages').click() |
321 | 834 | >>> jblack_browser.getControl(name='field.status_filter').value = ['any'] | 834 | >>> jblack_browser.getControl(name='field.status_filter').value = [''] |
322 | 835 | >>> jblack_browser.getControl("Filter").click() | 835 | >>> jblack_browser.getControl("Filter").click() |
323 | 836 | 836 | ||
324 | 837 | >>> print_ppa_packages(jblack_browser.contents) | 837 | >>> print_ppa_packages(jblack_browser.contents) |
325 | @@ -886,7 +886,7 @@ | |||
326 | 886 | >>> jblack_browser.open( | 886 | >>> jblack_browser.open( |
327 | 887 | ... 'http://launchpad.dev/~jblack/+archive/ppa/+packages') | 887 | ... 'http://launchpad.dev/~jblack/+archive/ppa/+packages') |
328 | 888 | >>> jblack_browser.getLink('Copy packages').click() | 888 | >>> jblack_browser.getLink('Copy packages').click() |
330 | 889 | >>> jblack_browser.getControl(name='field.status_filter').value = ['any'] | 889 | >>> jblack_browser.getControl(name='field.status_filter').value = [''] |
331 | 890 | >>> jblack_browser.getControl("Filter").click() | 890 | >>> jblack_browser.getControl("Filter").click() |
332 | 891 | 891 | ||
333 | 892 | >>> deleted_pub_id = getPPAPubIDsFor( | 892 | >>> deleted_pub_id = getPPAPubIDsFor( |
334 | 893 | 893 | ||
335 | === modified file 'lib/lp/soyuz/stories/ppa/xx-delete-packages.txt' | |||
336 | --- lib/lp/soyuz/stories/ppa/xx-delete-packages.txt 2009-09-12 01:57:22 +0000 | |||
337 | +++ lib/lp/soyuz/stories/ppa/xx-delete-packages.txt 2009-09-15 08:06:17 +0000 | |||
338 | @@ -211,7 +211,7 @@ | |||
339 | 211 | cdrkit - 1.0 2007-07-09 Deleted Breezy-autotest Editors i386 | 211 | cdrkit - 1.0 2007-07-09 Deleted Breezy-autotest Editors i386 |
340 | 212 | 212 | ||
341 | 213 | >>> cprov_browser.getControl( | 213 | >>> cprov_browser.getControl( |
343 | 214 | ... name='field.status_filter').value = ['any'] | 214 | ... name='field.status_filter').value = [''] |
344 | 215 | >>> cprov_browser.getControl('Filter', index=0).click() | 215 | >>> cprov_browser.getControl('Filter', index=0).click() |
345 | 216 | >>> print_ppa_packages(cprov_browser.contents) | 216 | >>> print_ppa_packages(cprov_browser.contents) |
346 | 217 | Source Published Status Series Section Build | 217 | Source Published Status Series Section Build |
347 | @@ -274,7 +274,7 @@ | |||
348 | 274 | Any user can see that all packages present in Celso's PPA are deleted. | 274 | Any user can see that all packages present in Celso's PPA are deleted. |
349 | 275 | 275 | ||
350 | 276 | >>> cprov_browser.getControl( | 276 | >>> cprov_browser.getControl( |
352 | 277 | ... name='field.status_filter').value = ['any'] | 277 | ... name='field.status_filter').value = [''] |
353 | 278 | >>> cprov_browser.getControl('Filter', index=0).click() | 278 | >>> cprov_browser.getControl('Filter', index=0).click() |
354 | 279 | >>> print_ppa_packages(cprov_browser.contents) | 279 | >>> print_ppa_packages(cprov_browser.contents) |
355 | 280 | Source Published Status Series Section Build | 280 | Source Published Status Series Section Build |
356 | @@ -421,7 +421,7 @@ | |||
357 | 421 | filter is 'Any Status', but the user can choose another. | 421 | filter is 'Any Status', but the user can choose another. |
358 | 422 | 422 | ||
359 | 423 | >>> print user_browser.getControl(name='field.status_filter').value | 423 | >>> print user_browser.getControl(name='field.status_filter').value |
361 | 424 | ['any'] | 424 | [''] |
362 | 425 | 425 | ||
363 | 426 | When the user selects 'Published' filter and update the results, no | 426 | When the user selects 'Published' filter and update the results, no |
364 | 427 | records are presented. | 427 | records are presented. |
365 | 428 | 428 | ||
366 | === modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt' | |||
367 | --- lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt 2009-09-12 06:49:56 +0000 | |||
368 | +++ lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt 2009-09-15 08:06:17 +0000 | |||
369 | @@ -273,7 +273,7 @@ | |||
370 | 273 | The 'Any Status' filter is also available, so the user can search over | 273 | The 'Any Status' filter is also available, so the user can search over |
371 | 274 | any package ever published in the context PPA. | 274 | any package ever published in the context PPA. |
372 | 275 | 275 | ||
374 | 276 | >>> anon_browser.getControl(name='field.status_filter').value = ['any'] | 276 | >>> anon_browser.getControl(name='field.status_filter').value = [''] |
375 | 277 | >>> anon_browser.getControl('Filter', index=0).click() | 277 | >>> anon_browser.getControl('Filter', index=0).click() |
376 | 278 | >>> print_archive_package_rows(anon_browser.contents) | 278 | >>> print_archive_package_rows(anon_browser.contents) |
377 | 279 | Source Published Status Series Section Build | 279 | Source Published Status Series Section Build |
378 | 280 | 280 | ||
379 | === modified file 'lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt' | |||
380 | --- lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt 2009-09-12 02:09:47 +0000 | |||
381 | +++ lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt 2009-09-15 08:06:17 +0000 | |||
382 | @@ -393,12 +393,12 @@ | |||
383 | 393 | 393 | ||
384 | 394 | == Filtering an archive == | 394 | == Filtering an archive == |
385 | 395 | 395 | ||
387 | 396 | The default series filter is 'any' which means that by default the | 396 | The default series filter is '' which means that by default the |
388 | 397 | results will include packages from any distro series. A user can | 397 | results will include packages from any distro series. A user can |
389 | 398 | explicitly set the 'Any Series' filter and get the same result: | 398 | explicitly set the 'Any Series' filter and get the same result: |
390 | 399 | 399 | ||
391 | 400 | >>> anon_browser.getControl(name='field.series_filter').value = ( | 400 | >>> anon_browser.getControl(name='field.series_filter').value = ( |
393 | 401 | ... ['any']) | 401 | ... ['']) |
394 | 402 | >>> anon_browser.getControl('Filter', index=0).click() | 402 | >>> anon_browser.getControl('Filter', index=0).click() |
395 | 403 | >>> print_archive_package_rows(anon_browser.contents) | 403 | >>> print_archive_package_rows(anon_browser.contents) |
396 | 404 | Package Version Uploaded by | 404 | Package Version Uploaded by |
= Summary =
This branch is a fix for bug 429263.
Since updating the filtering options for pkgs on ppas to use more
zope.formlib stuff, we can no-longer explicitly declare the null-option,
but need to rely on zope's built-in null option for choices (which gets
added irrespectively for non-required choices).
== Proposed fix ==
Remove our explicit 'any' option for status and series filters and
instead rely on zope's built-in None option.
== Pre-implementation notes ==
Discussed briefly with Celso to see how we had handled this in other
situations.
== Implementation details ==
I ended up with two near identical properties - selected_ status_ filter series_ filter - hence drying up with the erValue( ) method.
and selected_
getSelectedFilt
== Tests ==
bin/test -vv -t archive-views -t stories/ppa
== Demo and Q/A ==
There should no longer be a '(no value)' option at:
Local demo, play with filtering at: /launchpad. dev/~cprov/ +archive/ ppa /launchpad. dev/~cprov/ +archive/ ppa/+packages /launchpad. dev/~cprov/ +archive/ ppa/+copy- packages /launchpad. dev/~cprov/ +archive/ ppa/+delete- packages
https:/
https:/
https:/
https:/
On edge: similar sub-urls from:
https:/ /edge.launchpad .net/~cprov/ +archive/ ppa
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: soyuz/stories/ ppa/xx- ubuntu- ppas.txt soyuz/browser/ tests/archive- views.txt soyuz/stories/ ppa/xx- delete- packages. txt soyuz/stories/ ppa/xx- copy-packages. txt soyuz/stories/ ppa/xx- ppa-packages. txt soyuz/browser/ archive. py
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
--
Michael