Merge lp:~sinzui/launchpad/needs-packaging-bug-509848 into lp:launchpad/db-devel

Proposed by Curtis Hovey
Status: Merged
Approved by: Curtis Hovey
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~sinzui/launchpad/needs-packaging-bug-509848
Merge into: lp:launchpad/db-devel
Prerequisite: lp:~sinzui/launchpad/needs-linking-bug-507937
Diff against target: 858 lines (+503/-89)
17 files modified
lib/canonical/launchpad/doc/hierarchical-menu.txt (+15/-1)
lib/canonical/launchpad/icing/style-3-0.css (+1/-1)
lib/lp/app/browser/tests/base-layout.txt (+3/-3)
lib/lp/app/templates/base-layout-macros.pt (+17/-0)
lib/lp/app/templates/launchpad-hierarchy.pt (+8/-11)
lib/lp/registry/browser/configure.zcml (+14/-0)
lib/lp/registry/browser/distroseries.py (+30/-7)
lib/lp/registry/browser/sourcepackage.py (+58/-3)
lib/lp/registry/browser/tests/packaging-views.txt (+38/-1)
lib/lp/registry/browser/tests/sourcepackage-views.txt (+64/-0)
lib/lp/registry/stories/distroseries/xx-show-distroseries-packaging.txt (+60/-2)
lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt (+4/-3)
lib/lp/registry/stories/person/xx-admin-person-review.txt (+1/-1)
lib/lp/registry/templates/distroseries-needs-packaging.pt (+91/-0)
lib/lp/registry/templates/distroseries-packaging.pt (+1/-1)
lib/lp/registry/templates/sourcepackage-index.pt (+1/-55)
lib/lp/registry/templates/sourcepackage-portlet-associations.pt (+97/-0)
To merge this branch: bzr merge lp:~sinzui/launchpad/needs-packaging-bug-509848
Reviewer Review Type Date Requested Status
Martin Albisetti (community) ui Approve
Eleanor Berger (community) code Approve
Review via email: mp+17848@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :
Download full text (3.4 KiB)

This is my branch to add the view for +needs-packaging. It also fixes two
bread crumb bugs: do not link the last item and white space is underlined.

    lp:~sinzui/launchpad/needs-packaging-bug-509848
    Diff size: 340
    Launchpad bug: https://bugs.launchpad.net/bugs/509848
                   https://bugs.launchpad.net/bugs/83613
                   https://bugs.launchpad.net/bugs/480473
    Test command: ./bin/test -vv \
        -t hierarchical-menu \
        -t packaging-views \
        -t xx-show-distroseries-packaging
    Pre-implementation: bac, beuno
    Target release: 10.01

Add the view for +needs-packaging
---------------------------------

Add a view and template to list the packages that need packaging links.
The view should follow the example in the ubuntu-link-to-upstream blueprint.

Rules
-----

    * Create a view that shows the prioritised listing of packages that need
      packaging links
    * Each item must show information that encourages users to link the
      package to an upstream project.
    * ADDENDUM: Fix the trailing bread crumb, it should not be linked because
      it is the current page. Fix the white space too.

QA
--

Visit staging (This relies on a model that depends upon a schema change)

    * https://staging.launchpad.net/ubuntu/lucid/+needs-packaging
    * Verify it lists the source packages that are not linked to upstream
    * Verify the link link to Upstream links works
    * Verify the page lists 100 packages.
    * Verify that the packages appear to be listed in order of bugs with
      the highest heat and most translatable messages. Since this information
      is not visible, it is difficult to judge. The crucial issue is, does
      the ordering look sane?

Lint
----

Linting changed files:
  lib/canonical/launchpad/doc/hierarchical-menu.txt
  lib/canonical/launchpad/icing/style-3-0.css
  lib/lp/app/templates/launchpad-hierarchy.pt
  lib/lp/registry/browser/configure.zcml
  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-needs-packaging.pt

Test
----

    * lib/canonical/launchpad/doc/hierarchical-menu.txt
      * Updated test to verify that the last bread crumb is not linked.
    * lib/lp/registry/browser/tests/packaging-views.txt
      * Add a test for the new view to verify the page_title and label, as
        well as the BatchNavigator settings.
    * lib/lp/registry/stories/distroseries/xx-show-distroseries-packaging.txt
      * Add a simple story to demonstrate what any user can do with the
        page.
      * There is an XXX for a the portlet that will be added in my next
        branch.

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

    * lib/canonical/launchpad/icing/style-3-0.css
      * Added a "narrow" class that uses the paragraph for content that
        is difficult to use when it fills the available space.
    * lib/lp/app/templates/launchpad-hierarchy.pt
      * Removed the access white space that cause the odd underlining in
        some browsers.
      * Added an omit-tag rule so that the last bread crumb is not linked.
  ...

Read more...

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

Hi Martin.

This branch adds the +needs-packaging page as proposed in
    https://blueprints.launchpad.net/launchpad-registry/+spec/ubuntu-link-to-upstream

It differs from the design in the proposal because the missing branch column will always be missing, as noted by Brad; it was not adding information. The content was difficult to read at full width so I contrained to to match the paragraph's width. Please note tha the odd numbers in the table are because sample data is bad.

    http://launchpadlibrarian.net/38198401/needs-packaging.png

You asked if the user could edit the information from this page. The answer is no. We are linking directly to the source package page because that page *will* ask the user to select the upstream project from a list of candidates, or choose by search.

Revision history for this message
Eleanor Berger (intellectronica) wrote :

(10:51:18) intellectronica: sinzui: unless it's necessary (because the extra whitespace creates formatting problems), i prefer closing html tags on a new line. can you change the anchor on line 19 of your diff?
(10:51:45) intellectronica: and in the template too, of course
(10:52:19) beuno is now known as beuno-lunch
(10:52:22) sinzui: oh, that is clumbs of me. I will fix both
(10:52:27) sinzui: clumbsy
(10:52:36) intellectronica: cool, thanks
(10:55:00) intellectronica: sinzui: 'packagings' reads quite funny to me. are you sure this is the best choice? i would have dropped the plural s (but i'm not a native speaker so be critical with my english advice)
(10:56:56) intellectronica: sinzui: everything else looks good to me, so r=me
(10:57:04) sinzui: thanks
(10:57:28) intellectronica: sinzui: note that i haven't done any ui reviewing at all. i'll leave that for beuno-lunch (or noodles)
(10:58:10) sinzui: intellectronica: understood

review: Approve (code)
Revision history for this message
Martin Albisetti (beuno) wrote :

Hi Curtis,

A few quick thoughts:

- I think that the table can be re-worked to something like this:

------------------------------------------------------
       Source Package | Bugs | Translations |
------------------------------------------------------
  [] pmount | _12 bugs_ | _12 strings_ |
  [] alsa-utils | _1 bug_ | _0 strings_ |
  [] cnews | No bugs | No strings |
------------------------------------------------------

What's the "Upstream links" option? I don't understand the difference between that one and the one we're on.

review: Needs Fixing (ui)
Revision history for this message
Curtis Hovey (sinzui) wrote :

Hi Martin.

I updated the format and content of the table.
http://people.canonical.com/~curtis/needs-packaging.png

Revision history for this message
Martin Albisetti (beuno) wrote :

Thanks for the fixes Curtis.
The only remaining confusion seems to be the "Needs upstream links" / "Upstream links" links.
How about "Needs upstream links" / "All upstream links"?

review: Approve (ui)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/doc/hierarchical-menu.txt'
2--- lib/canonical/launchpad/doc/hierarchical-menu.txt 2009-10-15 13:17:58 +0000
3+++ lib/canonical/launchpad/doc/hierarchical-menu.txt 2010-01-30 22:41:18 +0000
4@@ -233,9 +233,23 @@
5 ... for step in hierarchy]
6 ... print 'Location:', ' > '.join(segments)
7
8- >>> print_hierarchy(hierarchy.render())
9+ >>> markup = hierarchy.render()
10+ >>> print_hierarchy(markup)
11 Location: Joy of cooking > Spam
12
13+The items in the breadcrumbs are linked, except for the last one which
14+represents the current location.
15+
16+ >>> print markup
17+ <ol class="breadcrumbs">
18+ <li>
19+ <a href="http://launchpad.dev/joy-of-cooking">Joy of cooking</a>
20+ </li>
21+ <li>
22+ Spam
23+ </li>
24+ </ol>
25+
26 The Launchpad Homepage displays no items in its location bar. We are
27 considered to be on the home page if there are no breadcrumbs.
28
29
30=== modified file 'lib/canonical/launchpad/icing/style-3-0.css'
31--- lib/canonical/launchpad/icing/style-3-0.css 2010-01-14 04:55:10 +0000
32+++ lib/canonical/launchpad/icing/style-3-0.css 2010-01-30 22:41:18 +0000
33@@ -161,7 +161,7 @@
34 width: auto;
35 margin-bottom: 0.8em;
36 }
37-p, li, dt, dd, blockquote {
38+p, li, dt, dd, blockquote, .narrow {
39 max-width: 45em; /* Wrap the text before the eye gets lost. */
40 }
41 pre, code, samp, tt, .console {
42
43=== modified file 'lib/lp/app/browser/tests/base-layout.txt'
44--- lib/lp/app/browser/tests/base-layout.txt 2009-10-02 21:00:37 +0000
45+++ lib/lp/app/browser/tests/base-layout.txt 2010-01-30 22:41:18 +0000
46@@ -94,7 +94,7 @@
47 <div class="yui-b" dir="ltr">
48 <div>
49 <h2>Heading</h2>
50- <ol class="breadcrumbs" xmlns="http://www.w3.org/1999/xhtml">
51+ <ol class="breadcrumbs">
52 ...
53
54 Top portlet.
55@@ -190,7 +190,7 @@
56 <div class="yui-b" dir="ltr">
57 <div>
58 <BLANKLINE>
59- <ol class="breadcrumbs" xmlns="http://www.w3.org/1999/xhtml">
60+ <ol class="breadcrumbs">
61 <BLANKLINE>
62 </ol>
63 <BLANKLINE>
64@@ -310,7 +310,7 @@
65 <div class="yui-b" dir="ltr">
66 <div>
67 <BLANKLINE>
68- <ol class="breadcrumbs" xmlns="http://www.w3.org/1999/xhtml">
69+ <ol class="breadcrumbs">
70 <BLANKLINE>
71 </ol>
72 ...
73
74=== modified file 'lib/lp/app/templates/base-layout-macros.pt'
75--- lib/lp/app/templates/base-layout-macros.pt 2010-01-22 15:47:53 +0000
76+++ lib/lp/app/templates/base-layout-macros.pt 2010-01-30 22:41:18 +0000
77@@ -391,4 +391,21 @@
78 </div>
79 </metal:site-message>
80
81+<metal:plural-msg define-macro="plural-message">
82+ <tal:comment condition="nothing">
83+ Expected variables to be defined in a containing tag or global:
84+ count - value to check to determine plural form
85+ singluar - string to use when count == 1
86+ plural - string to use when count > 1. If no plural is given it defaults
87+ to the singular value + 's'.
88+ </tal:comment>
89+ <tal:singular
90+ condition="python: count == 1"
91+ replace="singular" />
92+ <tal:plural
93+ define="l_default string:s;
94+ l_plural plural | string:$singular$l_default;"
95+ condition="python: count != 1"
96+ replace="l_plural" />
97+</metal:plural-msg>
98 </macros>
99
100=== modified file 'lib/lp/app/templates/launchpad-hierarchy.pt'
101--- lib/lp/app/templates/launchpad-hierarchy.pt 2009-09-18 17:38:50 +0000
102+++ lib/lp/app/templates/launchpad-hierarchy.pt 2010-01-30 22:41:18 +0000
103@@ -1,6 +1,5 @@
104 <ol
105 class="breadcrumbs"
106- xmlns="http://www.w3.org/1999/xhtml"
107 xmlns:tal="http://xml.zope.org/namespaces/tal"
108 xmlns:metal="http://xml.zope.org/namespaces/metal"
109 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
110@@ -9,16 +8,14 @@
111 <tal:breadcrumbs repeat="breadcrumb view/items"
112 condition="view/display_breadcrumbs">
113 <li>
114- <a tal:attributes="href breadcrumb/url">
115- <tal:text condition="not: repeat/breadcrumb/end"
116- replace="breadcrumb/text">
117- Bugs on redfish
118- </tal:text>
119- <tal:text condition="repeat/breadcrumb/end"
120- replace="breadcrumb/text/fmt:shorten/40">
121- Bugs on redfish
122- </tal:text>
123- </a>
124+ <a tal:attributes="href breadcrumb/url"
125+ tal:omit-tag="repeat/breadcrumb/end"><tal:text
126+ condition="not: repeat/breadcrumb/end"
127+ replace="breadcrumb/text">
128+ Bugs on redfish</tal:text><tal:text
129+ condition="repeat/breadcrumb/end"
130+ replace="breadcrumb/text/fmt:shorten/40">
131+ Bugs on redfish</tal:text></a>
132 </li>
133 </tal:breadcrumbs>
134 </ol>
135
136=== modified file 'lib/lp/registry/browser/configure.zcml'
137--- lib/lp/registry/browser/configure.zcml 2010-01-21 23:46:24 +0000
138+++ lib/lp/registry/browser/configure.zcml 2010-01-30 22:41:18 +0000
139@@ -101,6 +101,13 @@
140 template="../templates/distroseries-packaging.pt"/>
141 <browser:page
142 for="lp.registry.interfaces.distroseries.IDistroSeries"
143+ class="lp.registry.browser.distroseries.DistroSeriesNeedsPackagesView"
144+ permission="zope.Public"
145+ name="+needs-packaging"
146+ facet="overview"
147+ template="../templates/distroseries-needs-packaging.pt"/>
148+ <browser:page
149+ for="lp.registry.interfaces.distroseries.IDistroSeries"
150 permission="launchpad.Admin"
151 facet="overview"
152 class="canonical.launchpad.browser.ObjectReassignmentView"
153@@ -1937,6 +1944,13 @@
154 <browser:page
155 for="lp.registry.interfaces.sourcepackage.ISourcePackage"
156 permission="zope.Public"
157+ name="+portlet-associations"
158+ facet="overview"
159+ class="lp.registry.browser.sourcepackage.SourcePackageAssociationPortletView"
160+ template="../templates/sourcepackage-portlet-associations.pt"/>
161+ <browser:page
162+ for="lp.registry.interfaces.sourcepackage.ISourcePackage"
163+ permission="zope.Public"
164 class="lp.registry.browser.sourcepackage.SourcePackageHelpView"
165 name="+gethelp"
166 facet="answers"
167
168=== modified file 'lib/lp/registry/browser/distroseries.py'
169--- lib/lp/registry/browser/distroseries.py 2010-01-05 16:19:13 +0000
170+++ lib/lp/registry/browser/distroseries.py 2010-01-30 22:41:18 +0000
171@@ -150,9 +150,9 @@
172
173 usedfor = IDistroSeries
174 facet = 'overview'
175- links = ['edit', 'reassign', 'driver', 'answers', 'packaging',
176- 'add_port', 'create_milestone', 'admin', 'builds', 'queue',
177- 'subscribe']
178+ links = ['edit', 'reassign', 'driver', 'answers',
179+ 'packaging', 'needs_packaging', 'builds', 'queue',
180+ 'add_port', 'create_milestone', 'subscribe', 'admin']
181
182 @enabled_with_permission('launchpad.Admin')
183 def edit(self):
184@@ -177,8 +177,14 @@
185 return Link('+addmilestone', text, summary, icon='add')
186
187 def packaging(self):
188- text = 'Upstream links'
189- return Link('+packaging', text, icon='info')
190+ text = 'All upstream links'
191+ summary = 'A listing of source pakages and their upstream projects'
192+ return Link('+packaging', text, summary=summary, icon='info')
193+
194+ def needs_packaging(self):
195+ text = 'Needs upstream links'
196+ summary = 'A listing of source pakages without upstream projects'
197+ return Link('+needs-packaging', text, summary=summary, icon='info')
198
199 # A search link isn't needed because the distro series overview
200 # has a search form.
201@@ -463,7 +469,7 @@
202 """A View to show series package to upstream package relationships."""
203
204 label = 'Mapping series packages to upstream project series'
205- page_title = 'Upstream packaging links'
206+ page_title = 'All upstream links'
207
208 @cachedproperty
209 def unlinked_translatables(self):
210@@ -486,4 +492,21 @@
211 def cached_packagings(self):
212 """The batched upstream packaging links."""
213 packagings = self.context.packagings
214- return BatchNavigator(packagings, self.request, size=200)
215+ navigator = BatchNavigator(packagings, self.request, size=200)
216+ navigator.setHeadings('packaging', 'packagings')
217+ return navigator
218+
219+
220+class DistroSeriesNeedsPackagesView(DistroSeriesView):
221+ """A View to show series package to upstream package relationships."""
222+
223+ label = 'Packages that need upstream packaging links'
224+ page_title = 'Needs upstream links'
225+
226+ @cachedproperty
227+ def cached_unlinked_packages(self):
228+ """The batched `ISourcePackage`s that needs packaging links."""
229+ packages = self.context.getPriorizedUnlinkedSourcePackages()
230+ navigator = BatchNavigator(packages, self.request, size=100)
231+ navigator.setHeadings('package', 'packages')
232+ return navigator
233
234=== modified file 'lib/lp/registry/browser/sourcepackage.py'
235--- lib/lp/registry/browser/sourcepackage.py 2009-12-18 13:25:19 +0000
236+++ lib/lp/registry/browser/sourcepackage.py 2010-01-30 22:41:18 +0000
237@@ -6,6 +6,7 @@
238 __metaclass__ = type
239
240 __all__ = [
241+ 'SourcePackageAssociationPortletView',
242 'SourcePackageBreadcrumb',
243 'SourcePackageChangeUpstreamView',
244 'SourcePackageFacets',
245@@ -16,12 +17,20 @@
246 ]
247
248 from apt_pkg import ParseSrcDepends
249+from cgi import escape
250 from zope.component import getUtility, getMultiAdapter
251 from zope.app.form.interfaces import IInputWidget
252-from zope.formlib.form import FormFields
253+from zope.formlib.form import Fields, FormFields
254+from zope.interface import Interface
255+from zope.schema import Choice
256+from zope.schema.vocabulary import (
257+ getVocabularyRegistry, SimpleVocabulary, SimpleTerm)
258
259 from lazr.restful.interface import copy_field
260
261+from canonical.cachedproperty import cachedproperty
262+from canonical.widgets import LaunchpadRadioWidget
263+
264 from canonical.launchpad import helpers
265 from lp.bugs.browser.bugtask import BugTargetTraversalMixin
266 from canonical.launchpad.browser.packagerelationship import (
267@@ -35,8 +44,9 @@
268 from lp.translations.interfaces.potemplate import IPOTemplateSet
269 from canonical.launchpad import _
270 from canonical.launchpad.webapp import (
271- action, ApplicationMenu, GetitemNavigation, LaunchpadEditFormView, Link,
272- redirection, StandardLaunchpadFacets, stepto)
273+ action, ApplicationMenu, custom_widget, GetitemNavigation,
274+ LaunchpadEditFormView, LaunchpadFormView, Link, redirection,
275+ StandardLaunchpadFacets, stepto)
276 from canonical.launchpad.webapp import canonical_url
277 from canonical.launchpad.webapp.authorization import check_permission
278 from canonical.launchpad.webapp.breadcrumb import Breadcrumb
279@@ -294,3 +304,48 @@
280 """A View to show Answers help."""
281
282 page_title = 'Help and support options'
283+
284+
285+class SourcePackageAssociationPortletView(LaunchpadFormView):
286+ """A view for linking to an upstream package."""
287+
288+ schema = Interface
289+ custom_widget(
290+ 'upstream', LaunchpadRadioWidget, orientation='vertical')
291+ product_suggestions = None
292+
293+ def setUpFields(self):
294+ """See `LaunchpadFormView`."""
295+ super(SourcePackageAssociationPortletView, self).setUpFields()
296+ # Find registered products that are similarly named to the source
297+ # package.
298+ product_vocab = getVocabularyRegistry().get(None, 'Product')
299+ matches = product_vocab.searchForTerms(self.context.name)
300+ # Based upon the matching products, create a new vocabulary with
301+ # term descriptions that include a link to the product.
302+ self.product_suggestions = []
303+ vocab_terms = []
304+ for item in matches:
305+ product = item.value
306+ self.product_suggestions.append(product)
307+ item_url = canonical_url(product)
308+ description = """<a href="%s">%s</a>""" % (
309+ item_url, escape(product.displayname))
310+ vocab_terms.append(SimpleTerm(product, product.name, description))
311+ upstream_vocabulary = SimpleVocabulary(vocab_terms)
312+
313+ self.form_fields = Fields(
314+ Choice(__name__='upstream',
315+ title=_('Registered upstream project'),
316+ default=None,
317+ vocabulary=upstream_vocabulary,
318+ required=True))
319+
320+ @action('Link to Upstream Project', name='link')
321+ def link(self, action, data):
322+ upstream = data.get('upstream')
323+ self.context.setPackaging(upstream.development_focus, self.user)
324+ self.request.response.addInfoNotification(
325+ 'The project %s was linked to this source package.' %
326+ upstream.displayname)
327+ self.next_url = self.request.getURL()
328
329=== modified file 'lib/lp/registry/browser/tests/packaging-views.txt'
330--- lib/lp/registry/browser/tests/packaging-views.txt 2010-01-22 16:52:37 +0000
331+++ lib/lp/registry/browser/tests/packaging-views.txt 2010-01-30 22:41:18 +0000
332@@ -353,7 +353,7 @@
333 Mapping series packages to upstream project series
334
335 >>> print view.page_title
336- Upstream packaging links
337+ All upstream links
338
339 The view provides a property to get the source packages that have
340 translations, but are not linked to an upstream project. The view filters
341@@ -376,6 +376,9 @@
342 >>> batch_navigator.default_size
343 200
344
345+ >>> print batch_navigator.heading
346+ packagings
347+
348 >>> for packaging in batch_navigator.batch:
349 ... print packaging.sourcepackagename.name
350 evolution
351@@ -389,3 +392,37 @@
352 ... hoary, name='+packaging', query_string='start=2')
353 >>> view.show_unlinked_translatables
354 False
355+
356+
357+Distro series +needs-packaging view
358+-----------------------------------
359+
360+The +needs-packaging view lists the source packages that needs packaging
361+links to an upstream project.
362+
363+ >>> view = create_initialized_view(hoary, name='+needs-packaging')
364+ >>> print view.label
365+ Packages that need upstream packaging links
366+
367+ >>> print view.page_title
368+ Needs upstream links
369+
370+The view provides the cached_unlinked_packages property to access a
371+`BatchNavigator` of `ISourcePackages`.
372+
373+ >>> batch_navigator = view.cached_unlinked_packages
374+ >>> batch_navigator.default_size
375+ 100
376+
377+ >>> print batch_navigator.heading
378+ packages
379+
380+ >>> for summary in batch_navigator.batch:
381+ ... print summary['package'].name
382+ pmount
383+ alsa-utils
384+ cnews
385+ libstdc++
386+ linux-source-2.6.15
387+ thunderbird
388+ hot
389
390=== modified file 'lib/lp/registry/browser/tests/sourcepackage-views.txt'
391--- lib/lp/registry/browser/tests/sourcepackage-views.txt 2009-10-27 04:04:55 +0000
392+++ lib/lp/registry/browser/tests/sourcepackage-views.txt 2010-01-30 22:41:18 +0000
393@@ -1,6 +1,8 @@
394 SourcePackage views
395 ===================
396
397+Edit packaging view
398+-------------------
399
400 >>> product = factory.makeProduct(name='bonkers', displayname='Bonkers')
401 >>> productseries = factory.makeProductSeries(
402@@ -96,3 +98,65 @@
403
404 >>> print view.request.response.notifications
405 []
406+
407+Upstream associations portlet
408+-----------------------------
409+
410+The upstreams associations portlet either displays the upstream
411+information if it is already set or gives the user the opportunity to
412+suggest the association. The suggestion is based on a
413+ProductVocabulary query using the source package name.
414+
415+Since the bonkers source project was associated previously with the
416+bonkers project, the portlet will display that information.
417+
418+ >>> view = create_initialized_view(package, name='+portlet-associations')
419+ >>> for product in view.product_suggestions:
420+ ... print product.name
421+ bonkers
422+
423+ >>> from canonical.launchpad.testing.pages import (
424+ ... extract_text, find_tag_by_id)
425+ >>> content = extract_text(find_tag_by_id(view.render(), 'upstreams'))
426+ >>> print content
427+ Project:...Bonkers...
428+ Series:...crazy...
429+
430+A new source project that is not linked to an upstream will result in
431+the portlet showing the suggested project.
432+
433+ >>> product = factory.makeProduct(name='lernid', displayname='Lernid')
434+ >>> sourcepackagename = factory.makeSourcePackageName(name='lernid')
435+ >>> package = factory.makeSourcePackage(
436+ ... sourcepackagename=sourcepackagename, distroseries=distroseries)
437+
438+ >>> view = create_initialized_view(package, name='+portlet-associations')
439+ >>> for product in view.product_suggestions:
440+ ... print product.name
441+ lernid
442+
443+ >>> content = extract_text(find_tag_by_id(view.render(), 'no-upstreams'))
444+ >>> print content
445+ Launchpad doesn&#8217;t know which project and series this
446+ package belongs to. ...
447+ Is the following project the upstream for this source package?
448+ Registered upstream project:
449+ Lernid...
450+
451+If there are multiple potential matches they are all shown.
452+
453+ >>> product = factory.makeProduct(name='lernid-dev', displayname='Lernid Dev')
454+ >>> view = create_initialized_view(package, name='+portlet-associations')
455+ >>> for product in view.product_suggestions:
456+ ... print product.name
457+ lernid
458+ lernid-dev
459+
460+ >>> content = extract_text(find_tag_by_id(view.render(), 'no-upstreams'))
461+ >>> print content
462+ Launchpad doesn&#8217;t know which project and series this
463+ package belongs to. ...
464+ Is one of these projects the upstream for this source package?
465+ Registered upstream project:
466+ Lernid...
467+ Lernid Dev...
468
469=== modified file 'lib/lp/registry/stories/distroseries/xx-show-distroseries-packaging.txt'
470--- lib/lp/registry/stories/distroseries/xx-show-distroseries-packaging.txt 2009-12-10 19:58:31 +0000
471+++ lib/lp/registry/stories/distroseries/xx-show-distroseries-packaging.txt 2010-01-30 22:41:18 +0000
472@@ -5,9 +5,9 @@
473 series +index page.
474
475 >>> anon_browser.open('http://launchpad.dev/ubuntu/hoary')
476- >>> anon_browser.getLink('Upstream links').click()
477+ >>> anon_browser.getLink('All upstream links').click()
478 >>> print anon_browser.title
479- Upstream packaging links : ...
480+ All upstream links : ...
481
482 The page lists the the source packages that have translations, but are
483 not linked to an upstream project to sync them to.
484@@ -46,3 +46,61 @@
485
486 >>> print find_tag_by_id(content, 'unlinked_translatables')
487 None
488+
489+
490+Source packages that need packaging links
491+-----------------------------------------
492+
493+The "Packages that need upstream packaging links" lists the source packages
494+that need upstream packaging links. The list is prioritized so that the
495+packages with the greatest need are listed first.
496+
497+ >>> # XXX sinzui 2010-01-21 bug=487793: Enable this when the portlet
498+ >>> # is added.
499+ >>> #anon_browser.open('http://launchpad.dev/ubuntu/hoary')
500+ >>> #anon_browser.getLink('Needs upstream links').click()
501+ >>> anon_browser.open(
502+ ... 'http://launchpad.dev/ubuntu/hoary/+needs-packaging')
503+ >>> print anon_browser.title
504+ Needs upstream links : ...
505+
506+ >>> content = find_main_content(anon_browser.contents)
507+ >>> print extract_text(find_tag_by_id(content, 'packages'))
508+ Source Package Bugs Translations
509+ pmount No bugs 64 strings
510+ alsa-utils No bugs No strings
511+ cnews No bugs No strings
512+ libstdc++ No bugs No strings
513+ linux-source-2.6.15 1 bug No strings
514+
515+The counts in the listing link to their respect bugs and translations
516+pages.
517+
518+ >>> anon_browser.getLink('64 strings')
519+ <Link text='64 strings'
520+ url='http://translations.launchpad.dev/ubuntu/hoary/+source/pmount'>
521+
522+ >>> anon_browser.getLink('1 bug')
523+ <Link text='1 bug'
524+ url='http://bugs.launchpad.dev/ubuntu/+source/linux-source-2.6.15'>
525+
526+
527+The listing is batched so that the user can visit the next page listings.
528+
529+ >>> print extract_text(find_tag_by_id(content, 'listing-navigation'))
530+ 1 ... 5 of 5 packages First ... Previous ... Next ... Last
531+
532+Any use can see that this page is related to the packaging report. It is
533+linked, but the link to this page is not enabled.
534+
535+ >>> print extract_text(find_tag_by_id(content, 'related-pages'))
536+ Needs upstream links All upstream links
537+
538+ >>> anon_browser.getLink('All upstream links')
539+ <Link text='All upstream links'
540+ url='http://launchpad.dev/ubuntu/hoary/+packaging'>
541+
542+ >>> anon_browser.getLink('Needs upstream links')
543+ Traceback (most recent call last):
544+ ...
545+ LinkNotFoundError
546
547=== modified file 'lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt'
548--- lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt 2009-12-08 05:02:32 +0000
549+++ lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt 2010-01-30 22:41:18 +0000
550@@ -15,13 +15,14 @@
551 >>> user_browser.getLink('pmount').click()
552 >>> print extract_text(find_tag_by_id(
553 ... user_browser.contents, 'no-upstreams'))
554- Launchpad doesn&#8217;t know which project and series this package
555- belongs to. ... Can you set the upstream project in Launchpad?
556+ There are no projects registered in Launchpad that are a potential
557+ match for this source package. Can you help us find one?
558+ Set upstream link
559
560 No Privileges Person knows that the pmount package comes from the thunderbird
561 project. He sets the upstream packaging link and sees that it is set.
562
563- >>> user_browser.getLink('set the upstream project in Launchpad').click()
564+ >>> user_browser.getLink('Set upstream link').click()
565 >>> user_browser.getControl(
566 ... name="field.productseries").value = 'thunderbird/trunk'
567 >>> user_browser.getControl("Change").click()
568
569=== modified file 'lib/lp/registry/stories/person/xx-admin-person-review.txt'
570--- lib/lp/registry/stories/person/xx-admin-person-review.txt 2010-01-04 23:07:32 +0000
571+++ lib/lp/registry/stories/person/xx-admin-person-review.txt 2010-01-30 22:41:18 +0000
572@@ -47,7 +47,7 @@
573
574 The page also contains a link back to the +review page.
575
576- >>> link = admin_browser.getLink(url='+review', index=1)
577+ >>> link = admin_browser.getLink(url='+review')
578 >>> print link.text
579 edit[IMG] Review the user's Launchpad information
580
581
582=== added file 'lib/lp/registry/templates/distroseries-needs-packaging.pt'
583--- lib/lp/registry/templates/distroseries-needs-packaging.pt 1970-01-01 00:00:00 +0000
584+++ lib/lp/registry/templates/distroseries-needs-packaging.pt 2010-01-30 22:41:18 +0000
585@@ -0,0 +1,91 @@
586+<html
587+ xmlns="http://www.w3.org/1999/xhtml"
588+ xmlns:tal="http://xml.zope.org/namespaces/tal"
589+ xmlns:metal="http://xml.zope.org/namespaces/metal"
590+ xmlns:i18n="http://xml.zope.org/namespaces/i18n"
591+ metal:use-macro="view/macro:page/main_only"
592+ i18n:domain="launchpad">
593+ <body>
594+ <div metal:fill-slot="main">
595+ <div class="top-portlet">
596+ <p>
597+ Links from distribution packages to upstream project series let
598+ distribution and upstream maintainers share bugs, patches, and
599+ translations efficiently.
600+ </p>
601+
602+ <p>
603+ The packages are listed by priority. Packages that greatest need to
604+ forward bugs, sync translations, or need the latest development
605+ branch are listed first. Can you help link these packages to
606+ registered Launchpad projects?
607+ </p>
608+
609+ <ul id="related-pages" class="horizontal">
610+ <li>
611+ <a tal:replace="structure context/menu:overview/needs_packaging/fmt:link" />
612+ </li>
613+ <li>
614+ <a tal:replace="structure context/menu:overview/packaging/fmt:link" />
615+ </li>
616+ </ul>
617+ </div>
618+
619+ <div class="narrow"
620+ tal:define="summaries view/cached_unlinked_packages;"
621+ tal:condition="summaries/batch">
622+ <div id="listing-navigation"
623+ tal:content="structure summaries/@@+navigation-links-upper" />
624+
625+ <table id="packages" class="listing">
626+ <thead>
627+ <tr>
628+ <th>Source Package</th>
629+ <th>Bugs</th>
630+ <th>Translations</th>
631+ </tr>
632+ </thead>
633+
634+ <tbody>
635+ <tr tal:repeat="summary summaries/batch">
636+ <td>
637+ <a class="sprite package-source"
638+ tal:attributes="href summary/package/fmt:url"
639+ tal:content="summary/package/name">evolution</a>
640+ </td>
641+ <td tal:define="count summary/total_bugs;
642+ singular string:bug;
643+ plural string:bugs;">
644+ <tal:no-bugs condition="not: count">
645+ No bugs
646+ </tal:no-bugs>
647+ <tal:has-bugs condition="count">
648+ <a tal:attributes="href summary/package/distribution_sourcepackage/fmt:url:bugs"
649+ ><tal:total-bugs replace="count" />
650+ <tal:plural
651+ metal:use-macro="context/@@+base-layout-macros/plural-message"/></a>
652+ </tal:has-bugs>
653+ </td>
654+ <td tal:define="count summary/total_messages;
655+ singular string:string;
656+ plural string:strings;">
657+ <tal:no-translations condition="not:count">
658+ No strings
659+ </tal:no-translations>
660+ <tal:has-translations condition="count">
661+ <a tal:attributes="href summary/package/fmt:url:translations"
662+ ><tal:total-messages replace="count" />
663+ <tal:plural
664+ metal:use-macro="context/@@+base-layout-macros/plural-message"/></a>
665+ </tal:has-translations>
666+ </td>
667+ </tr>
668+ </tbody>
669+ </table>
670+
671+ <div class="results"
672+ tal:content="structure summaries/@@+navigation-links-lower" />
673+ </div>
674+ </div>
675+ </body>
676+</html>
677
678=== modified file 'lib/lp/registry/templates/distroseries-packaging.pt'
679--- lib/lp/registry/templates/distroseries-packaging.pt 2009-12-04 00:24:03 +0000
680+++ lib/lp/registry/templates/distroseries-packaging.pt 2010-01-30 22:41:18 +0000
681@@ -40,7 +40,7 @@
682 </div>
683
684 <tal:known_links condition="packagings/batch">
685- <h2>Upstream links</h2>
686+ <h2>All upstream links</h2>
687
688 <div class="results"
689 tal:content="structure packagings/@@+navigation-links-upper" />
690
691=== modified file 'lib/lp/registry/templates/sourcepackage-index.pt'
692--- lib/lp/registry/templates/sourcepackage-index.pt 2009-12-03 16:54:29 +0000
693+++ lib/lp/registry/templates/sourcepackage-index.pt 2010-01-30 22:41:18 +0000
694@@ -55,61 +55,7 @@
695 </div>
696
697 <div class="yui-u">
698- <div class="portlet"
699- tal:define="series context/productseries">
700- <h2>Upstream associations</h2>
701-
702- <tal:has_series condition="series">
703- <div id="upstreams" class="two-column-list">
704- <dl
705- tal:define="project series/product/project"
706- tal:condition="project">
707- <dt>Project Group:</dt>
708- <dd>
709- <a tal:replace="structure project/fmt:link" />
710- </dd>
711- </dl>
712-
713- <dl>
714- <dt>Project:</dt>
715- <dd>
716- <a tal:replace="structure series/product/fmt:link" />
717- </dd>
718- </dl>
719-
720- <dl>
721- <dt>Series:</dt>
722- <dd>
723- <a
724- tal:content="series/name"
725- tal:attributes="href series/fmt:url">Series</a>
726- <a tal:replace="structure context/menu:overview/edit_packaging/fmt:icon" />
727- </dd>
728- </dl>
729- </div>
730-
731- <ul class="horizontal">
732- <li>
733- <a
734- tal:attributes="href series/product/menu:overview/packages/fmt:url"
735- >Show upstream links</a>
736- </li>
737- </ul>
738- </tal:has_series>
739-
740- <tal:has_no_series condition="not: series">
741- <p id="no-upstreams">
742- Launchpad doesn&#8217;t know which project and series this
743- package belongs to. Links from distribution packages to
744- upstream project let distribution and upstream
745- maintainers share bugs, patches, and translations
746- efficiently. Can you
747- <a tal:attributes="
748- href context/menu:overview/edit_packaging/url">set
749- the upstream project in Launchpad</a>?
750- </p>
751- </tal:has_no_series>
752- </div>
753+ <div class="portlet" tal:content="structure context/@@+portlet-associations" />
754 </div>
755 </div>
756
757
758=== added file 'lib/lp/registry/templates/sourcepackage-portlet-associations.pt'
759--- lib/lp/registry/templates/sourcepackage-portlet-associations.pt 1970-01-01 00:00:00 +0000
760+++ lib/lp/registry/templates/sourcepackage-portlet-associations.pt 2010-01-30 22:41:18 +0000
761@@ -0,0 +1,97 @@
762+<tal:root
763+ xmlns:tal="http://xml.zope.org/namespaces/tal"
764+ xmlns:metal="http://xml.zope.org/namespaces/metal"
765+ xmlns:i18n="http://xml.zope.org/namespaces/i18n"
766+ omit-tag="">
767+
768+ <div id="portlet-associations">
769+ <h2>Upstream associations</h2>
770+
771+ <div class="portletBody portletContent"
772+ tal:define="series context/productseries">
773+ <tal:has_series condition="series">
774+ <div id="upstreams" class="two-column-list">
775+ <dl
776+ tal:define="project series/product/project"
777+ tal:condition="project">
778+ <dt>Project Group:</dt>
779+ <dd>
780+ <a tal:replace="structure project/fmt:link" />
781+ </dd>
782+ </dl>
783+
784+ <dl>
785+ <dt>Project:</dt>
786+ <dd>
787+ <a tal:replace="structure series/product/fmt:link" />
788+ </dd>
789+ </dl>
790+
791+ <dl>
792+ <dt>Series:</dt>
793+ <dd>
794+ <a
795+ tal:content="series/name"
796+ tal:attributes="href series/fmt:url">Series</a>
797+ <a tal:replace="structure context/menu:overview/edit_packaging/fmt:icon" />
798+ </dd>
799+ </dl>
800+ </div>
801+
802+ <ul class="horizontal">
803+ <li>
804+ <a
805+ tal:attributes="href series/product/menu:overview/packages/fmt:url"
806+ >Show upstream links</a>
807+ </li>
808+ </ul>
809+ </tal:has_series>
810+
811+ <tal:has_no_series condition="not: series">
812+ <div id="no-upstreams" tal:condition="view/product_suggestions">
813+ <p>
814+ Launchpad doesn&#8217;t know which project and series this
815+ package belongs to. Links from distribution packages to
816+ upstream project let distribution and upstream
817+ maintainers share bugs, patches, and translations
818+ efficiently.
819+ </p>
820+
821+ <tal:message
822+ define="count python:len(view.product_suggestions);
823+ singular string:Is the following project the upstream for this source package?;
824+ plural string:Is one of these projects the upstream for this source package?"
825+ >
826+ <b>
827+ <metal:message use-macro="context/@@+base-layout-macros/plural-message"/>
828+ </b>
829+ </tal:message>
830+
831+ <div tal:condition="python: len(view.product_suggestions) > 1">
832+ <b>Is one of these projects the upstream for this source
833+ package?</b>
834+ </div>
835+ <div tal:condition="python: len(view.product_suggestions) == 1">
836+ <b>Is the following project the upstream for this source package?</b>
837+ </div>
838+ <div metal:use-macro="context/@@launchpad_form/form">
839+ <div class="actions" metal:fill-slot="buttons">
840+ <input tal:replace="structure view/link/render"/>
841+ &nbsp;or&nbsp;
842+ <a tal:replace="structure
843+ context/menu:overview/set_upstream/fmt:link" />
844+ </div>
845+ </div>
846+ </div>
847+ <div id="no-upstreams" tal:condition="not: view/product_suggestions">
848+ <p>
849+ There are no projects registered in Launchpad that are a potential
850+ match for this source package. Can you help us find one?
851+ </p>
852+ <a tal:replace="structure
853+ context/menu:overview/set_upstream/fmt:link" />
854+ </div>
855+ </tal:has_no_series>
856+ </div>
857+ </div>
858+</tal:root>

Subscribers

People subscribed via source and target branches

to status/vote changes: