Merge lp:~sinzui/launchpad/mental-health-0 into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Approved by: Brad Crittenden
Approved revision: no longer in the source branch.
Merged at revision: 10951
Proposed branch: lp:~sinzui/launchpad/mental-health-0
Merge into: lp:launchpad
Diff against target: 316 lines (+80/-31)
14 files modified
lib/canonical/launchpad/webapp/configure.zcml (+6/-0)
lib/canonical/launchpad/webapp/tales.py (+11/-0)
lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt (+2/-3)
lib/lp/bugs/stories/guided-filebug/xx-distro-guided-filebug-tags.txt (+4/-4)
lib/lp/bugs/stories/guided-filebug/xx-filebug-tags.txt (+5/-5)
lib/lp/bugs/templates/bugtask-macros-tableview.pt (+3/-2)
lib/lp/bugs/tests/bug.py (+8/-0)
lib/lp/registry/browser/person.py (+3/-3)
lib/lp/registry/browser/product.py (+7/-1)
lib/lp/registry/browser/tests/test_product.py (+9/-0)
lib/lp/registry/stories/mailinglists/subscriptions.txt (+1/-1)
lib/lp/registry/templates/team-mailinglist-subscribers.pt (+7/-2)
lib/lp/registry/templates/team-portlet-mailinglist.pt (+13/-9)
lib/lp/soyuz/templates/build-index.pt (+1/-1)
To merge this branch: bzr merge lp:~sinzui/launchpad/mental-health-0
Reviewer Review Type Date Requested Status
Brad Crittenden (community) Approve
Review via email: mp+26832@code.launchpad.net

Description of the change

This is my branch to fix some trivial issues to recover my mind.

    lp:~sinzui/launchpad/mental-health-0
    Diff size: 265
    Launchpad bug: https://bugs.launchpad.net/bugs/588820
                   https://bugs.launchpad.net/bugs/583311
                   https://bugs.launchpad.net/bugs/401923
    Test command: ./bin/test -vv \
        -t TestProductLicenseMixin -t stories/mailinglists/subscriptions
        -t xx-official-bug-tags.txt -t xx-distro-guided-filebug-tags.txt
        -t xx-filebug-tags.txt
    Pre-implementation: no one.
    Target release: 10.06

Fix some trivial issues to recover my mind
-------------------------------------------

Bug #588820 [licence emails leave a bad timestamp on the whiteboard]
    The whiteboard date is wrong, minutes are shown where a month is
    expected.

Bug #583311 [Better wording for team mailing list section]
    The wording implies that the team does not have a mailing list, but
    the team may have one hosted else where, like lists.ubuntu.com/

Bug #401923 [advanced search pop up help for tags doesn't work if you are
    in a different domain]
    Help fails to load on
    https://edge.launchpad.net/launchpad/+bugs?advanced=1
    because the bugs domain was not specified in the help link. Help is
    specific to domains, so the domain must be used if the help is used
    by more than one domain.

Rules
-----

Bug #588820 [licence emails leave a bad timestamp on the whiteboard]
    * Extract the date formatting rule so that it can be tested.
    * use mm instead of MM to insert the month.

Bug #583311 [Better wording for team mailing list section]
    * Use "This team does not use Launchpad to host a mailing list." to
      make it clear to used who view the team page that Launchpad does
      not know about the mailing list. We still want to show a message so that
      users do not search Launchpad for information that does not exist. This
      may prevent novice admins from trying to register an ubuntu list from
      Launchpad (We see this mistake every few months.)

Bug #401923 [advanced search pop up help for tags doesn't work if you are
    in a different domain]
    * Extract the common bug tag testing pattern to a test helper so that
      only one rule needs updating for the url change.
    * Include the bugs domain in the tags help link. Tags is the only
      part of the form that uses a help link, but it the bugs rooturl should
      be available to any part of the form.

QA
--

Bug #588820 [license emails leave a bad timestamp on the whiteboard]
    * During project review
    * Verify that the "I don't know" projects have a sane date.

Bug #583311 [Better wording for team mailing list section]
    * Visit https://launchpad.net/~ubuntu-l10n-es
    * Verify the page states:
      "This team does not use Launchpad to host a mailing list."

Bug #401923 [advanced search pop up help for tags doesn't work if you are
    in a different domain]
    * Visit https://edge.launchpad.net/launchpad/+bugs?advanced=1
    * Verify that the tag help displays when accessed.

Lint
----

Linting changed files:
  lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt
  lib/lp/bugs/stories/guided-filebug/xx-distro-guided-filebug-tags.txt
  lib/lp/bugs/stories/guided-filebug/xx-filebug-tags.txt
  lib/lp/bugs/templates/bugtask-macros-tableview.pt
  lib/lp/bugs/tests/bug.py
  lib/lp/registry/browser/person.py
  lib/lp/registry/browser/product.py
  lib/lp/registry/browser/tests/test_product.py
  lib/lp/registry/stories/mailinglists/subscriptions.txt
  lib/lp/registry/templates/team-mailinglist-subscribers.pt
  lib/lp/registry/templates/team-portlet-mailinglist.pt

Test
----

    * lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt
    * lib/lp/bugs/stories/guided-filebug/xx-distro-guided-filebug-tags.txt
    * lib/lp/bugs/stories/guided-filebug/xx-filebug-tags.txt
      * Extracted the common pattern to a helper. Updated two tests to
        show that the tag are unofficial.

    * lib/lp/registry/browser/tests/test_product.py
      * Added a test to verify the date is formatted with the month.

    * lib/lp/registry/stories/mailinglists/subscriptions.txt
      * Updated the test to verify that that the team does not have
        a Launchpad hosted mailing list.

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

    * lib/lp/bugs/templates/bugtask-macros-tableview.pt
      * Added the bugs vhost to the tag help link.

    * lib/lp/bugs/tests/bug.py
      * Added a new test helper based on the common pattern in story tests.
        Changed the help link guard to work with the bugs domain.

    * lib/lp/registry/browser/person.py
    * lib/lp/registry/templates/team-mailinglist-subscribers.pt
    * lib/lp/registry/templates/team-portlet-mailinglist.pt
      * Clarified the no mailing list message.

    * lib/lp/registry/browser/product.py
      * Extracted the date format rules to a testable method, then fixed
        the format string to use the month.

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

You are my hero. Very nice fixes all.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/webapp/configure.zcml'
2--- lib/canonical/launchpad/webapp/configure.zcml 2010-05-27 22:18:16 +0000
3+++ lib/canonical/launchpad/webapp/configure.zcml 2010-06-05 05:08:27 +0000
4@@ -469,6 +469,12 @@
5 name="fmt"
6 />
7 <adapter
8+ for="lp.code.interfaces.sourcepackagerecipebuild.ISourcePackageRecipeBuild"
9+ provides="zope.traversing.interfaces.IPathAdapter"
10+ factory="canonical.launchpad.webapp.tales.SourcePackageRecipeBuildFormatterAPI"
11+ name="fmt"
12+ />
13+ <adapter
14 for="canonical.launchpad.interfaces.ISpecification"
15 provides="zope.traversing.interfaces.IPathAdapter"
16 factory="canonical.launchpad.webapp.tales.SpecificationFormatterAPI"
17
18=== modified file 'lib/canonical/launchpad/webapp/tales.py'
19--- lib/canonical/launchpad/webapp/tales.py 2010-05-27 22:18:16 +0000
20+++ lib/canonical/launchpad/webapp/tales.py 2010-06-05 05:08:27 +0000
21@@ -1606,6 +1606,17 @@
22 'owner': self._context.owner.displayname}
23
24
25+class SourcePackageRecipeBuildFormatterAPI(CustomizableFormatter):
26+ """Adapter providing fmt support for ISourcePackageRecipe objects."""
27+
28+ _link_summary_template = '%(name)s recipe build [%(owner)s/%(archive)s]'
29+
30+ def _link_summary_values(self):
31+ return {'name': self._context.recipe.base_branch.unique_name,
32+ 'owner': self._context.archive.owner.name,
33+ 'archive': self._context.archive.name}
34+
35+
36 class SpecificationFormatterAPI(CustomizableFormatter):
37 """Adapter providing fmt support for Specification objects"""
38
39
40=== modified file 'lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt'
41--- lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt 2010-04-29 15:24:12 +0000
42+++ lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt 2010-06-05 05:08:27 +0000
43@@ -60,6 +60,7 @@
44
45 >>> from canonical.launchpad.ftests import login, logout
46 >>> from canonical.launchpad.webapp import canonical_url
47+ >>> from lp.bugs.tests.bug import print_bug_tag_anchors
48 >>> import transaction
49 >>> login('foo.bar@canonical.com')
50 >>> gfoobar = factory.makeProduct(name='gfoobar')
51@@ -72,9 +73,7 @@
52
53 >>> browser.open(gfoobar_bug_url)
54 >>> tags_div = find_tag_by_id(browser.contents, 'bug-tags')
55- >>> for anchor in tags_div.findAll('a'):
56- ... if anchor['href'] != '+edit' and anchor['href'] != '/+help/tag-help.html':
57- ... print anchor['class'], anchor.contents[0]
58+ >>> print_bug_tag_anchors(tags_div.findAll('a'))
59 official-tag alpha
60 official-tag charlie
61 unofficial-tag bravo
62
63=== modified file 'lib/lp/bugs/stories/guided-filebug/xx-distro-guided-filebug-tags.txt'
64--- lib/lp/bugs/stories/guided-filebug/xx-distro-guided-filebug-tags.txt 2010-04-29 15:24:12 +0000
65+++ lib/lp/bugs/stories/guided-filebug/xx-distro-guided-filebug-tags.txt 2010-06-05 05:08:27 +0000
66@@ -21,6 +21,8 @@
67
68 After submitting the bug, the tags are added to the bug.
69
70+ >>> from lp.bugs.tests.bug import print_bug_tag_anchors
71+
72 >>> user_browser.getControl('Further information').value = 'Thanks.'
73 >>> user_browser.getControl('Submit Bug Report').click()
74
75@@ -28,7 +30,5 @@
76 'http://bugs.launchpad.dev/ubuntu/+bug/...'
77
78 >>> tags_div = find_tag_by_id(user_browser.contents, 'bug-tags')
79- >>> for a_tag in tags_div('a'):
80- ... if a_tag['href'] != '+edit' and a_tag['href'] != '/+help/tag-help.html':
81- ... print a_tag.renderContents()
82- new-package
83+ >>> print_bug_tag_anchors(tags_div('a'))
84+ unofficial-tag new-package
85
86=== modified file 'lib/lp/bugs/stories/guided-filebug/xx-filebug-tags.txt'
87--- lib/lp/bugs/stories/guided-filebug/xx-filebug-tags.txt 2010-04-29 15:24:12 +0000
88+++ lib/lp/bugs/stories/guided-filebug/xx-filebug-tags.txt 2010-06-05 05:08:27 +0000
89@@ -6,6 +6,8 @@
90 On the normal +filebug page, tags can be added to the bug as the bug
91 is being filed.
92
93+ >>> from lp.bugs.tests.bug import print_bug_tag_anchors
94+
95 >>> user_browser.open(
96 ... 'http://bugs.launchpad.dev/firefox/+filebug')
97 >>> user_browser.getControl('Summary').value = "Bug with tags"
98@@ -18,11 +20,9 @@
99 'http://bugs.launchpad.dev/firefox/+bug/...'
100
101 >>> tags_div = find_tag_by_id(user_browser.contents, 'bug-tags')
102- >>> for a_tag in tags_div('a'):
103- ... if a_tag['href'] != '+edit' and a_tag['href'] != '/+help/tag-help.html':
104- ... print a_tag.renderContents()
105- bar
106- foo
107+ >>> print_bug_tag_anchors(tags_div('a'))
108+ unofficial-tag bar
109+ unofficial-tag foo
110
111
112 == Pre-populating the tags field ==
113
114=== modified file 'lib/lp/bugs/templates/bugtask-macros-tableview.pt'
115--- lib/lp/bugs/templates/bugtask-macros-tableview.pt 2010-03-04 20:53:52 +0000
116+++ lib/lp/bugs/templates/bugtask-macros-tableview.pt 2010-06-05 05:08:27 +0000
117@@ -234,7 +234,8 @@
118 </metal:header>
119
120
121-<metal:advanced_search_form define-macro="advanced_search_form">
122+<metal:advanced_search_form define-macro="advanced_search_form"
123+ tal:define="bugs_rooturl modules/canonical.launchpad.webapp.vhosts/allvhosts/configs/bugs/rooturl">
124
125 <form class="long" name="search" method="get" action="">
126 <span tal:condition="view/current_package|nothing">
127@@ -527,7 +528,7 @@
128 tal:content="structure view/widgets/tag/label">
129 Tag
130 </label>: <input tal:replace="structure view/widgets/tag" />
131- <a href="/+help/tag-search.html"
132+ <a tal:attributes="href string:${bugs_rooturl}/+help/tag-search.html"
133 target="help">Tag search help</a>
134 <div
135 tal:condition="error"
136
137=== modified file 'lib/lp/bugs/tests/bug.py'
138--- lib/lp/bugs/tests/bug.py 2010-02-26 09:54:20 +0000
139+++ lib/lp/bugs/tests/bug.py 2010-06-05 05:08:27 +0000
140@@ -321,3 +321,11 @@
141 '/%s/+bugtarget-portlet-bugfilters-stats' % target)
142 table = BeautifulSoup('<table>%s</table>' % browser.contents)
143 print_table(table)
144+
145+
146+def print_bug_tag_anchors(anchors):
147+ """The the bug tags in the iterable of anchors."""
148+ for anchor in anchors:
149+ href = anchor['href']
150+ if href != '+edit' and '/+help/tag-help.html' not in href:
151+ print anchor['class'], anchor.contents[0]
152
153=== modified file 'lib/lp/registry/browser/person.py'
154--- lib/lp/registry/browser/person.py 2010-05-28 23:06:25 +0000
155+++ lib/lp/registry/browser/person.py 2010-06-05 05:08:27 +0000
156@@ -1942,7 +1942,7 @@
157 extra_params=critical_bugs_params)
158
159 def getHighBugsURL(self, distributionsourcepackage):
160- """Return URL for high importance bugs on distributionsourcepackage."""
161+ """Return URL for high bugs on distributionsourcepackage."""
162 high_bugs_params = {
163 'field.status': [], 'field.importance': "High"}
164
165@@ -2503,7 +2503,7 @@
166 if self.user == self.context:
167 return 'Your Launchpad Karma'
168 else:
169- return 'Launchpad Karma for %s' % self.context.displayname
170+ return 'Launchpad Karma for %s' % self.context.displayname
171
172 @cachedproperty
173 def has_karma(self):
174@@ -3208,7 +3208,7 @@
175 mailing_list = self.context.mailing_list
176 if mailing_list is None:
177 raise UnexpectedFormData(
178- _("This team does not have a mailing list."))
179+ _("This team does not use Launchpad to host a mailing list."))
180 if not self.user:
181 raise Unauthorized(
182 _("You must be logged in to unsubscribe."))
183
184=== modified file 'lib/lp/registry/browser/product.py'
185--- lib/lp/registry/browser/product.py 2010-05-24 04:55:08 +0000
186+++ lib/lp/registry/browser/product.py 2010-06-05 05:08:27 +0000
187@@ -292,7 +292,7 @@
188
189 def _addLicenseChangeToReviewWhiteboard(self):
190 """Update the whiteboard for the reviewer's benefit."""
191- now = datetime.now(tz=pytz.UTC).strftime('%Y-%M-%d')
192+ now = self._formatDate()
193 whiteboard = 'User notified of license policy on %s.' % now
194 naked_product = removeSecurityProxy(self.product)
195 if naked_product.reviewer_whiteboard is None:
196@@ -300,6 +300,12 @@
197 else:
198 naked_product.reviewer_whiteboard += '\n' + whiteboard
199
200+ def _formatDate(self, now=None):
201+ """Return the date formatted for messages."""
202+ if now is None:
203+ now = datetime.now(tz=pytz.UTC)
204+ return now.strftime('%Y-%m-%d')
205+
206
207 class ProductFacets(QuestionTargetFacetMixin, StandardLaunchpadFacets):
208 """The links that will appear in the facet menu for an IProduct."""
209
210=== modified file 'lib/lp/registry/browser/tests/test_product.py'
211--- lib/lp/registry/browser/tests/test_product.py 2010-05-11 20:01:34 +0000
212+++ lib/lp/registry/browser/tests/test_product.py 2010-06-05 05:08:27 +0000
213@@ -5,8 +5,11 @@
214
215 __metaclass__ = type
216
217+import datetime
218 import unittest
219
220+import pytz
221+
222 from zope.security.proxy import removeSecurityProxy
223
224 from canonical.testing.layers import DatabaseFunctionalLayer
225@@ -102,6 +105,12 @@
226 self.verify_user_email(notifications.pop())
227 self.verify_commercial_email(notifications.pop())
228
229+ def test__formatDate(self):
230+ # Verify the date format.
231+ now = datetime.datetime(2005, 6, 15, 0, 0, 0, 0, pytz.UTC)
232+ result = self.view._formatDate(now)
233+ self.assertEqual('2005-06-15', result)
234+
235
236 def test_suite():
237 return unittest.TestLoader().loadTestsFromName(__name__)
238
239=== modified file 'lib/lp/registry/stories/mailinglists/subscriptions.txt'
240--- lib/lp/registry/stories/mailinglists/subscriptions.txt 2010-02-26 00:03:09 +0000
241+++ lib/lp/registry/stories/mailinglists/subscriptions.txt 2010-06-05 05:08:27 +0000
242@@ -372,7 +372,7 @@
243 >>> print extract_text(
244 ... find_portlet(browser.contents, 'Mailing list'))
245 Mailing list
246- This team does not have a mailing list.
247+ This team does not use Launchpad to host a mailing list.
248 Create a mailing list
249
250 >>> browser.getLink('Subscribe')
251
252=== modified file 'lib/lp/registry/templates/team-mailinglist-subscribers.pt'
253--- lib/lp/registry/templates/team-mailinglist-subscribers.pt 2009-09-14 01:28:41 +0000
254+++ lib/lp/registry/templates/team-mailinglist-subscribers.pt 2010-06-05 05:08:27 +0000
255@@ -25,8 +25,13 @@
256 </tal:no-subscribers>
257 </tal:has-mailinglist>
258 <tal:no_mailing_list condition="not: context/mailing_list">
259- <p>This team does not have a mailing list.</p>
260- <p><a href="+mailinglist">Configure</a> the team's mailing list.</p>
261+ <p>This team does not use Launchpad to host a mailing list.</p>
262+ <ul class="horizontal">
263+ <li>
264+ <tal:configure_mailing_list
265+ replace="structure context/menu:overview/configure_mailing_list/fmt:link-icon" />
266+ </li>
267+ </ul>
268 </tal:no_mailing_list>
269 </div>
270
271
272=== modified file 'lib/lp/registry/templates/team-portlet-mailinglist.pt'
273--- lib/lp/registry/templates/team-portlet-mailinglist.pt 2010-02-25 23:29:29 +0000
274+++ lib/lp/registry/templates/team-portlet-mailinglist.pt 2010-06-05 05:08:27 +0000
275@@ -41,15 +41,19 @@
276 >View subscribers</a>
277 </div>
278 <div tal:condition="not: view/archive_url">
279- This team does not have a mailing list.
280- </div>
281- <div tal:condition="context/menu:overview/configure_mailing_list/enabled">
282- <tal:configure_mailing_list
283- replace="structure context/menu:overview/configure_mailing_list/fmt:link-icon" />
284- &nbsp;
285- <tal:moderate_mailing_list
286- replace="structure context/menu:overview/moderate_mailing_list/fmt:link-icon" />
287- </div>
288+ This team does not use Launchpad to host a mailing list.
289+ </div>
290+ <ul class="horizontal"
291+ tal:condition="context/menu:overview/configure_mailing_list/enabled">
292+ <li>
293+ <tal:configure_mailing_list
294+ replace="structure context/menu:overview/configure_mailing_list/fmt:link-icon" />
295+ </li>
296+ <li>
297+ <tal:moderate_mailing_list
298+ replace="structure context/menu:overview/moderate_mailing_list/fmt:link-icon" />
299+ </li>
300+ </ul>
301 </div>
302 </div>
303 </tal:root>
304
305=== modified file 'lib/lp/soyuz/templates/build-index.pt'
306--- lib/lp/soyuz/templates/build-index.pt 2010-06-04 13:54:54 +0000
307+++ lib/lp/soyuz/templates/build-index.pt 2010-06-05 05:08:27 +0000
308@@ -79,7 +79,7 @@
309 </dd>
310 </dl>
311 <dl
312- tal:define="spr context/sourcepackagerelease"
313+ tal:define="spr context/source_package_release"
314 tal:condition="spr/source_package_recipe_build">
315 <dt>Source package recipe build:</dt>
316 <dd tal:content="structure spr/source_package_recipe_build/fmt:link">