Merge lp://staging/~sinzui/launchpad/all-upstream-links into lp://staging/launchpad

Proposed by Curtis Hovey
Status: Merged
Approved by: Brad Crittenden
Approved revision: not available
Merged at revision: not available
Proposed branch: lp://staging/~sinzui/launchpad/all-upstream-links
Merge into: lp://staging/launchpad
Diff against target: 460 lines (+165/-133)
9 files modified
lib/canonical/launchpad/doc/tales.txt (+18/-0)
lib/canonical/launchpad/webapp/tales.py (+11/-0)
lib/lp/app/templates/base-layout-macros.pt (+0/-7)
lib/lp/registry/browser/distroseries.py (+3/-20)
lib/lp/registry/browser/tests/packaging-views.txt (+8/-28)
lib/lp/registry/stories/distroseries/xx-show-distroseries-packaging.txt (+33/-25)
lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt (+5/-5)
lib/lp/registry/templates/distroseries-packaging.pt (+80/-34)
lib/lp/registry/templates/sourcepackage-portlet-associations.pt (+7/-14)
To merge this branch: bzr merge lp://staging/~sinzui/launchpad/all-upstream-links
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+19423@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

This is my branch to show a prioritised listing of upstream links that need
info.

    lp:~sinzui/launchpad/all-upstream-links
    Diff size: 378
    Launchpad bug: https://bugs.launchpad.net/bugs/512367
                   https://bugs.launchpad.net/bugs/240759
    Test command: ./bin/test -vv \
        -t doc/tales -t packaging-views -t xx-show-distroseries-views
    Pre-implementation: beuno, jml, bac
    Target release: 10.02

Show a prioritised listing upstream links that need info
--------------------------------------------------------

Update the DistroSeries +packaging page to show a prioritised list of
packagings that need information to send contributions upstream. The
presentation must show what is missing to encourage users to provide
it.

This branch also addresses an older bug to create a yes/no tales formatter.

Rules
-----

    * Update cached_packagings to use getPriorizedlPackagings()
    * Update the UI do show the upstream contributor information as
      a check list to show which information is complete or missing.
    * Add a link to +needs-packaging.
    * Remove the "Unlinked translatable packages" section because the
      +needs-packaging supersedes it.

QA
--

    * Visit https://edge.launchpad.net/ubuntu/lucid/+packaging
    * Verify there is no unlinked translatables section.
    * Verify there is a link to +needs-packaging
    * Verify that each packaging shows if contributor information is missing
      or complete.

Lint
----

Linting changed files:
  lib/canonical/launchpad/doc/tales.txt
  lib/canonical/launchpad/webapp/tales.py
  lib/lp/registry/browser/distroseries.py
  lib/lp/registry/browser/tests/packaging-views.txt
  lib/lp/registry/stories/distroseries/xx-show-distroseries-packaging.txt
  lib/lp/registry/templates/distroseries-packaging.pt

Test
----

    * lib/canonical/launchpad/doc/tales.txt
      * Added a test to verify the markup for image:boolean
    * lib/lp/registry/browser/tests/packaging-views.txt
      * Removed tests for unneeded properties
      * Updated tests to show the new order of packagings.
      * Updated test to show 100 is the default number shown per batch.
    * lib/lp/registry/stories/distroseries/xx-show-distroseries-packaging.txt
      * Updated story to show the information that any user can see on the
        page.

Implementation
--------------

    * lib/canonical/launchpad/webapp/tales.py
      * Added image:boolean tales formatter.
    * lib/lp/registry/browser/distroseries.py
      * Removed unneeded properties (they are redundant with a specialised
        view: +needs-packaging.)
      * Update the label (the <h2>) to clarify the purpose of the page.
      * Updated cached_packagings to use getPriorizedlPackagings() instead
        of distroseries.packagings.
    * lib/lp/registry/templates/distroseries-packaging.pt
      * Updated the template to show the contributor connection info for
        each upstream.

Revision history for this message
Curtis Hovey (sinzui) wrote :

This is the presentation that Martin and I agreed upon.
    http://people.canonical.com/~curtis/packaging.png

Revision history for this message
Brad Crittenden (bac) wrote :

Hi Curtis,

Thanks for this new work. It looks good to me and almost ready to land with a few wording changes I suggest.

s/Any use/Any user/

What about:
s/
The packages are listed by priority. Packages that greatest need to
forward bugs, sync translations, or need the latest development
branch are listed first.
/
The packages are listed by priority based on the greatest need to forward bugs, sync translations, or specify the latest development branch.
/

I notice you kept the simplified boolean for determining a project's bug tracker that doesn't consider the bug tracker for a project group. We can reconcile that when we factor out our branches.

review: Approve (code)
Revision history for this message
Brad Crittenden (bac) wrote :

BTW I like the TALES formatter better than the macro.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/doc/tales.txt'
2--- lib/canonical/launchpad/doc/tales.txt 2010-02-11 13:08:50 +0000
3+++ lib/canonical/launchpad/doc/tales.txt 2010-02-17 13:20:40 +0000
4@@ -203,6 +203,24 @@
5 >>> print test_tales("build/image:icon", build=build)
6 <img width="16" height="14"...src="/@@/build-failed" />
7
8+All objects can be represented as a boolean icon.
9+
10+ >>> print test_tales("context/image:boolean", context=None)
11+ <span class="sprite no">&nbsp;<span
12+ class="invisible-link">no</span></span>
13+
14+ >>> print test_tales("context/image:boolean", context=False)
15+ <span class="sprite no">&nbsp;<span
16+ class="invisible-link">no</span></span>
17+
18+ >>> print test_tales("context/image:boolean", context=object())
19+ <span class="sprite yes">&nbsp;<span
20+ class="invisible-link">yes</span></span>
21+
22+ >>> print test_tales("context/image:boolean", context=True)
23+ <span class="sprite yes">&nbsp;<span
24+ class="invisible-link">yes</span></span>
25+
26
27 The fmt: namespace to get strings
28 ---------------------------------
29
30=== modified file 'lib/canonical/launchpad/webapp/tales.py'
31--- lib/canonical/launchpad/webapp/tales.py 2010-02-11 13:08:50 +0000
32+++ lib/canonical/launchpad/webapp/tales.py 2010-02-17 13:20:40 +0000
33@@ -760,6 +760,17 @@
34 raise NotImplementedError(
35 "Badge display not implemented for this item")
36
37+ def boolean(self):
38+ """Return an icon representing the context as a boolean value."""
39+ if bool(self._context):
40+ icon = 'yes'
41+ else:
42+ icon = 'no'
43+ markup = (
44+ '<span class="sprite %(icon)s">&nbsp;'
45+ '<span class="invisible-link">%(icon)s</span></span>')
46+ return markup % dict(icon=icon)
47+
48
49 class BugTaskImageDisplayAPI(ObjectImageDisplayAPI):
50 """Adapter for IBugTask objects to a formatted string. This inherits
51
52=== modified file 'lib/lp/app/templates/base-layout-macros.pt'
53--- lib/lp/app/templates/base-layout-macros.pt 2010-02-16 14:21:35 +0000
54+++ lib/lp/app/templates/base-layout-macros.pt 2010-02-17 13:20:40 +0000
55@@ -410,11 +410,4 @@
56 condition="python: count != 1"
57 replace="l_plural" />
58 </metal:plural-msg>
59-
60-<metal:yes-no define-macro="yes-no">
61- <span tal:condition="bool"
62- class="sprite yes">&nbsp;<span class="invisible-link">yes</span></span>
63- <span tal:condition="not: bool"
64- class="sprite no">&nbsp;<span class="invisible-link">no</span></span>
65-</metal:yes-no>
66 </macros>
67
68=== modified file 'lib/lp/registry/browser/distroseries.py'
69--- lib/lp/registry/browser/distroseries.py 2010-01-25 21:00:03 +0000
70+++ lib/lp/registry/browser/distroseries.py 2010-02-17 13:20:40 +0000
71@@ -468,31 +468,14 @@
72 class DistroSeriesPackagesView(DistroSeriesView):
73 """A View to show series package to upstream package relationships."""
74
75- label = 'Mapping series packages to upstream project series'
76+ label = 'All series packages linked to upstream project series'
77 page_title = 'All upstream links'
78
79 @cachedproperty
80- def unlinked_translatables(self):
81- """The sourcepackages that lack a link to a productseries."""
82- packages = self.context.getUnlinkedTranslatableSourcePackages()
83- if self.context.distribution.full_functionality:
84- # Launchpad knows exactly what is published in the series.
85- packages = [package for package in packages
86- if package.currentrelease is not None]
87- return packages
88-
89- @cachedproperty
90- def show_unlinked_translatables(self):
91- """Are there unlinked translatables and should they be shown."""
92- return (
93- len(self.unlinked_translatables) > 0
94- and self.cached_packagings.start == 0)
95-
96- @cachedproperty
97 def cached_packagings(self):
98 """The batched upstream packaging links."""
99- packagings = self.context.packagings
100- navigator = BatchNavigator(packagings, self.request, size=200)
101+ packagings = self.context.getPriorizedlPackagings()
102+ navigator = BatchNavigator(packagings, self.request, size=100)
103 navigator.setHeadings('packaging', 'packagings')
104 return navigator
105
106
107=== modified file 'lib/lp/registry/browser/tests/packaging-views.txt'
108--- lib/lp/registry/browser/tests/packaging-views.txt 2010-01-26 20:31:13 +0000
109+++ lib/lp/registry/browser/tests/packaging-views.txt 2010-02-17 13:20:40 +0000
110@@ -350,48 +350,28 @@
111
112 >>> view = create_initialized_view(hoary, name='+packaging')
113 >>> print view.label
114- Mapping series packages to upstream project series
115+ All series packages linked to upstream project series
116
117 >>> print view.page_title
118 All upstream links
119
120-The view provides a property to get the source packages that have
121-translations, but are not linked to an upstream project. The view filters
122-unpublished versions from full functionality distributions like Ubuntu.
123-
124- >>> hoary.getUnlinkedTranslatableSourcePackages()
125- [<SourcePackage .../hoary/pmount>, <SourcePackage .../hoary/mozilla>]
126-
127- >>> view.show_unlinked_translatables
128- True
129-
130- >>> view.unlinked_translatables
131- [<SourcePackage ubuntu/hoary/pmount>]
132-
133-A distro series can have thousands of upstream packaging links. The view
134-provides a batch navigator to access the packagings. The default batch size
135-is 200.
136+The view provides a property to get prioritized list of series packagings.
137+The packages that most need more information to send bugs upstream, build
138+packages, and sync translations are listed first. A distro series can have
139+thousands of upstream packaging links. The view provides a batch navigator
140+to access the packagings. The default batch size is 100.
141
142 >>> batch_navigator = view.cached_packagings
143 >>> batch_navigator.default_size
144- 200
145+ 100
146
147 >>> print batch_navigator.heading
148 packagings
149
150 >>> for packaging in batch_navigator.batch:
151 ... print packaging.sourcepackagename.name
152+ netapplet
153 evolution
154- mozilla-firefox
155- netapplet
156-
157-The show_unlinked_translatables property is False when the batch is after the
158-first batch.
159-
160- >>> view = create_initialized_view(
161- ... hoary, name='+packaging', query_string='start=2')
162- >>> view.show_unlinked_translatables
163- False
164
165
166 Distro series +needs-packaging view
167
168=== modified file 'lib/lp/registry/stories/distroseries/xx-show-distroseries-packaging.txt'
169--- lib/lp/registry/stories/distroseries/xx-show-distroseries-packaging.txt 2010-01-25 21:00:03 +0000
170+++ lib/lp/registry/stories/distroseries/xx-show-distroseries-packaging.txt 2010-02-17 13:20:40 +0000
171@@ -9,21 +9,35 @@
172 >>> print anon_browser.title
173 All upstream links : ...
174
175-The page lists the the source packages that have translations, but are
176-not linked to an upstream project to sync them to.
177-
178- >>> content = find_main_content(anon_browser.contents)
179- >>> print extract_text(find_tag_by_id(content, 'unlinked-translatables'))
180- Unlinked translatable packages
181- pmount
182-
183 The page lists the upstream packaging links.
184
185- >>> print extract_text(find_tag_by_id(content, 'packagings'))
186- Source Package Upstream Project Series
187- evolution Evolution trunk series
188- mozilla-firefox Mozilla Firefox 1.0 series
189- netapplet NetApplet trunk series
190+ >>> content = find_main_content(anon_browser.contents)
191+ >>> print extract_text(
192+ ... find_tag_by_id(anon_browser.contents, 'packagings'))
193+ Source Package Upstream Project Upstream Contributor Connections
194+ netapplet
195+ NetApplet ... The Novell Network Applet
196+ NetApplet ... project: Bug supervisor: no Bug tracker: yes
197+ NetApplet trunk series: Branch: no
198+ evolution
199+ Evolution ... Evolution is an email client, addressbook ...
200+ Evolution ... project: Bug supervisor: no Bug tracker: yes
201+ Evolution trunk series: Branch: yes Translations: no
202+
203+Any use can see that this page is related to the needs packaging report. It
204+is linked, but the link to this page is not enabled.
205+
206+ >>> print extract_text(find_tag_by_id(content, 'related-pages'))
207+ Needs upstream links All upstream links
208+
209+ >>> anon_browser.getLink('Needs upstream links')
210+ <Link text='Needs upstream links'
211+ url='http://launchpad.dev/ubuntu/hoary/+needs-packaging'>
212+
213+ >>> anon_browser.getLink('All upstream links')
214+ Traceback (most recent call last):
215+ ...
216+ LinkNotFoundError
217
218 The packaging links are batched so that users can view the thousands of
219 links packages. Users can also hack the URL to set their own batch size.
220@@ -32,20 +46,14 @@
221 ... 'http://launchpad.dev/ubuntu/hoary/+packaging?start=0&batch=1')
222 >>> print extract_text(find_tag_by_id(
223 ... anon_browser.contents, 'packagings'))
224- Source Package Upstream Project Series
225- evolution Evolution trunk series
226+ Source Package Upstream Project Upstream Contributor Connections
227+ netapplet ...
228
229 >>> anon_browser.getLink('Next', index=0).click()
230- >>> content = find_main_content(anon_browser.contents)
231- >>> print extract_text(find_tag_by_id(content, 'packagings'))
232- Source Package Upstream Project Series
233- mozilla-firefox Mozilla Firefox 1.0 series
234-
235-The unlinked translatable source packages is not displayed on pages after
236-the first page.
237-
238- >>> print find_tag_by_id(content, 'unlinked_translatables')
239- None
240+ >>> print extract_text(
241+ ... find_tag_by_id(anon_browser.contents, 'packagings'))
242+ Source Package Upstream Project Upstream Contributor Connections
243+ evolution ...
244
245
246 Source packages that need packaging links
247
248=== modified file 'lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt'
249--- lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt 2010-02-12 11:45:37 +0000
250+++ lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt 2010-02-17 13:20:40 +0000
251@@ -3,11 +3,11 @@
252 No Privileges Person visit the distroseries upstream linkes page for Hoary
253 and sees that pmount is not linked.
254
255- >>> user_browser.open('http://launchpad.dev/ubuntu/hoary/+packaging')
256- >>> print extract_text(find_tag_by_id(
257- ... user_browser.contents, 'unlinked-translatables'))
258- Unlinked translatable packages
259- pmount
260+ >>> user_browser.open(
261+ ... 'http://launchpad.dev/ubuntu/hoary/+needs-packaging')
262+ >>> print extract_text(find_tag_by_id(user_browser.contents, 'packages'))
263+ Source Package Bugs Translations
264+ pmount No bugs 64 strings ...
265
266 He looks at the pmount source package page in Hoary and reads that the
267 upstream project is not set.
268
269=== modified file 'lib/lp/registry/templates/distroseries-packaging.pt'
270--- lib/lp/registry/templates/distroseries-packaging.pt 2010-01-25 21:00:03 +0000
271+++ lib/lp/registry/templates/distroseries-packaging.pt 2010-02-17 13:20:40 +0000
272@@ -15,61 +15,107 @@
273 translations efficiently.
274 </p>
275
276- <p class="informational message"
277- tal:condition="not: packagings/batch">
278- There are no links between packages in <span
279- tal:replace="context/displayname">Hoary</span> and upstream. By
280- adding information for specific packages, you can help the
281- distribution developers collaborate with upstream.
282+ <p>
283+ The packages are listed by priority based on the greatest need to
284+ forward bugs, sync translations, or specify the latest
285+ development branch.
286 </p>
287
288- <tal:unlinked_translatables
289- condition="view/show_unlinked_translatables">
290- <div id="unlinked-translatables">
291- <h2>Unlinked translatable packages</h2>
292-
293- <ul class="horizontal">
294- <li tal:repeat="sp view/unlinked_translatables">
295- <a class="sprite package-source"
296- tal:attributes="href sp/fmt:url"
297- tal:content="sp/sourcepackagename/name">evolution</a>
298- </li>
299- </ul>
300- </div>
301- </tal:unlinked_translatables>
302+ <ul id="related-pages" class="horizontal">
303+ <li>
304+ <a tal:replace="structure context/menu:overview/needs_packaging/fmt:link" />
305+ </li>
306+ <li>
307+ <a tal:replace="structure context/menu:overview/packaging/fmt:link" />
308+ </li>
309+ </ul>
310 </div>
311
312- <tal:known_links condition="packagings/batch">
313+ <div tal:condition="packagings/batch">
314 <h2>All upstream links</h2>
315
316 <div class="results"
317 tal:content="structure packagings/@@+navigation-links-upper" />
318
319- <table id="packagings" class="listing">
320+ <table id="packagings" class="listing" style="compact">
321+ <cols>
322+ <col />
323+ <col />
324+ <col style="width: 20em;"/>
325+ </cols>
326 <thead>
327 <tr>
328 <th>Source Package</th>
329- <th>Upstream Project Series</th>
330+ <th>Upstream Project</th>
331+ <th colspan="2">Upstream Contributor Connections</th>
332 </tr>
333 </thead>
334
335 <tbody>
336- <tr tal:repeat="packaging packagings/batch">
337- <td>
338- <a class="sprite package-source"
339- tal:attributes="href packaging/sourcepackage/fmt:url"
340- tal:content="packaging/sourcepackagename/name">evolution</a>
341- </td>
342- <td>
343- <a tal:replace="structure packaging/productseries/fmt:link" />
344- </td>
345- </tr>
346+ <tal:packaging repeat="packaging packagings/batch">
347+ <tr tal:define="series packaging/productseries;
348+ product series/product;
349+ package packaging/sourcepackage;
350+ translations package/getTranslationTemplates;">
351+ <td>
352+ <a class="sprite package-source"
353+ tal:attributes="href package/fmt:url"
354+ tal:content="package/name">evolution</a>
355+ </td>
356+
357+ <td>
358+ <div>
359+ <a tal:replace="structure product/fmt:link" />
360+ </div>
361+
362+ <div class="narrow"
363+ tal:condition="product/summary"
364+ tal:content="product/summary"/>
365+ </td>
366+
367+ <td>
368+ <dl>
369+ <dt>
370+ <a tal:replace="structure product/fmt:link" /> project:
371+ </dt>
372+ <dd title="Project bug supervisor">
373+ Bug supervisor:
374+ <tal:yes-no
375+ replace="structure product/bug_supervisor/image:boolean" />
376+ </dd>
377+ <dd title="Project bug tracker"
378+ tal:define="bool product/project|bugtracker|product/bugtracker|product/official_malone">
379+ Bug tracker:
380+ <tal:yes-no replace="structure bool/image:boolean"/>
381+ </dd>
382+ </dl>
383+ </td>
384+
385+ <td>
386+ <dl>
387+ <dt style="margin-bottom: 6px;">
388+ <a tal:replace="structure series/fmt:link" />:
389+ </dt>
390+ <dd title="Series branch">
391+ Branch:
392+ <tal:yes-no replace="structure series/branch/image:boolean"/>
393+ </dd>
394+ <dd title="Series translations auto import"
395+ tal:condition="translations"
396+ tal:define="bool not:series/translations_autoimport_mode/enumvalue:NO_IMPORT">
397+ Translations:
398+ <tal:yes-no replace="structure bool/image:boolean"/>
399+ </dd>
400+ </dl>
401+ </td>
402+ </tr>
403+ </tal:packaging>
404 </tbody>
405 </table>
406
407 <div class="results"
408 tal:content="structure packagings/@@+navigation-links-lower" />
409- </tal:known_links>
410+ </div>
411 </div>
412 </body>
413 </html>
414
415=== modified file 'lib/lp/registry/templates/sourcepackage-portlet-associations.pt'
416--- lib/lp/registry/templates/sourcepackage-portlet-associations.pt 2010-02-12 14:04:16 +0000
417+++ lib/lp/registry/templates/sourcepackage-portlet-associations.pt 2010-02-17 13:20:40 +0000
418@@ -24,36 +24,29 @@
419 </dd>
420 </tal:has_pg>
421
422- <dd title="Bug supervisor"
423- tal:define="bool series/product/bug_supervisor">
424+ <dd title="Bug supervisor">
425 Bug supervisor:
426- <metal:yes-no
427- use-macro="context/@@+base-layout-macros/yes-no" />
428+ <tal:yes-no replace="structure series/product/bug_supervisor/image:boolean"/>
429 </dd>
430
431- <dd title="Bug tracker"
432- tal:define="bool view/has_bugtracker">
433+ <dd title="Bug tracker">
434 Bug tracker:
435- <metal:yes-no
436- use-macro="context/@@+base-layout-macros/yes-no" />
437+ <tal:yes-no replace="structure view/has_bugtracker/image:boolean"/>
438 </dd>
439 </dl>
440 <dl>
441 <dt>
442 <a tal:replace="structure series/fmt:link" />
443 </dt>
444- <dd title="Series branch"
445- tal:define="bool series/branch">
446+ <dd title="Series branch">
447 Branch:
448- <metal:yes-no
449- use-macro="context/@@+base-layout-macros/yes-no" />
450+ <tal:yes-no replace="structure series/branch/image:boolean"/>
451 </dd>
452 <dd title="Series translations auto import"
453 tal:condition="context/getTranslationTemplates"
454 tal:define="bool not:series/translations_autoimport_mode/enumvalue:NO_IMPORT">
455 Translations:
456- <metal:yes-no
457- use-macro="context/@@+base-layout-macros/yes-no" />
458+ <tal:yes-no replace="structure bool/image:boolean"/>
459 </dd>
460 </dl>
461