Merge lp:~nigelbabu/launchpad/4595-upgrade-bug-linking into lp:launchpad

Proposed by Nigel Babu
Status: Merged
Approved by: Stuart Bishop
Approved revision: no longer in the source branch.
Merged at revision: 13761
Proposed branch: lp:~nigelbabu/launchpad/4595-upgrade-bug-linking
Merge into: lp:launchpad
Diff against target: 410 lines (+109/-57)
9 files modified
lib/lp/app/browser/linkchecker.py (+22/-1)
lib/lp/app/browser/stringformatter.py (+1/-1)
lib/lp/app/browser/tests/test_linkchecker.py (+46/-18)
lib/lp/app/browser/tests/test_stringformatter.py (+4/-4)
lib/lp/app/browser/tests/test_webservice.py (+1/-1)
lib/lp/app/doc/displaying-paragraphs-of-text.txt (+28/-28)
lib/lp/app/javascript/lp-links.js (+3/-0)
lib/lp/bugs/tests/test_bugs_webservice.py (+2/-2)
lib/lp/soyuz/stories/soyuz/xx-sourcepackage-changelog.txt (+2/-2)
To merge this branch: bzr merge lp:~nigelbabu/launchpad/4595-upgrade-bug-linking
Reviewer Review Type Date Requested Status
Benji York (community) code Approve
Stuart Bishop (community) Approve
Review via email: mp+71575@code.launchpad.net

Commit message

[r=benji,stub] [r=stub][bug=4595] Distinguish between valid and invalid bugs when autolinkifying bugs

Description of the change

Distinguish between valid and invalid bugs when autolinkifying bugs

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Per IRC, calling a private bug invalid is confusing. If you keep the method name the same, it needs a comment.

review: Approve
Revision history for this message
Stuart Bishop (stub) wrote :

15731 tests run in 3:56:26.265316, 7 failures, 0 errors

Failing tests
-------------
 lp.app.browser.tests.test_webservice.TestXHTMLRepresentations.test_text
 lib/lp/app/doc/displaying-paragraphs-of-text.txt
 lp.bugs.tests.test_bugs_webservice.TestBugDescriptionRepresentation.test_GET_xhtml_representation
 lp.bugs.tests.test_bugs_webservice.TestBugDescriptionRepresentation.test_PATCH_xhtml_representation
 lib/lp/soyuz/stories/soyuz/xx-sourcepackage-changelog.txt
 lp.app.browser.tests.test_stringformatter.TestLinkifyingBugs.test_explicit_bug_linkification
 lp.app.browser.tests.test_stringformatter.TestLinkifyingBugs.test_regular_bug_case_works

Look to be mainly mechanical problems with tests not coping with the new class attributes in the links.

Revision history for this message
Stuart Bishop (stub) wrote :
Download full text (14.5 KiB)

======================================================================
FAILURE: lp.app.browser.tests.test_webservice.TestXHTMLRepresentations.test_text (subunit.RemotedTestCase)
----------------------------------------------------------------------
_StringException: Text attachment: traceback
------------
Traceback (most recent call last):
_StringException: Traceback (most recent call last):
 File "/var/launchpad/test/lib/lp/app/browser/tests/test_webservice.py", line 50, in test_text
   renderer(text))
AssertionError: !=:
reference = u'<p>\u2603 <email address hidden> <a href="/bugs/1">bug 1</a></p>'
actual = u'<p>\u2603 <email address hidden> <a href="/bugs/1" class="bug-link">bug 1</a></p>'

------------

======================================================================
FAILURE: lib/lp/app/doc/displaying-paragraphs-of-text.txt (subunit.RemotedTestCase)
----------------------------------------------------------------------
_StringException: Text attachment: traceback
------------
Traceback (most recent call last):
 File "/usr/lib/python2.6/unittest.py", line 279, in run
   testMethod()
 File "/usr/lib/python2.6/doctest.py", line 2152, in runTest
   raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for displaying-paragraphs-of-text.txt
 File "lib/lp/app/doc/displaying-paragraphs-of-text.txt", line 0

----------------------------------------------------------------------
File "lib/lp/app/doc/displaying-paragraphs-of-text.txt", line 227, in displaying-paragraphs-of-text.txt
Failed example:
   print test_tales('foo/fmt:text-to-html', foo=text)
Differences (ndiff with -expected +actual):
   - <p><a href="/bugs/123">bug 123</a><br />
   + <p><a href="/bugs/123" class="bug-link">bug 123</a><br />
   ? +++++++++++++++++
   - <a href="/bugs/123">bug 123</a><br />
   + <a href="/bugs/123" class="bug-link">bug 123</a><br />
   ? +++++++++++++++++
   - <a href="/bugs/123">bug #123</a><br />
   + <a href="/bugs/123" class="bug-link">bug #123</a><br />
   ? +++++++++++++++++
   - <a href="/bugs/123">bug number 123</a><br />
   + <a href="/bugs/123" class="bug-link">bug number 123</a><br />
   ? +++++++++++++++++
     bug number. 123<br />
   - <a href="/bugs/123">bug num 123</a><br />
   + <a href="/bugs/123" class="bug-link">bug num 123</a><br />
   ? +++++++++++++++++
   - <a href="/bugs/123">bug num. 123</a><br />
   + <a href="/bugs/123" class="bug-link">bug num. 123</a><br />
   ? +++++++++++++++++
   - <a href="/bugs/123">bug no 123</a><br />
   + <a href="/bugs/123" class="bug-link">bug no 123</a><br />
   ? +++++++++++++++++
   - <a href="/bugs/123">bug report 123</a><br />
   + <a href="/bugs/123" class="bug-link">bug report 123</a><br />
   ? +++++++++++++++++
   - <a href="/bugs/123">bug no. 123</a><br />
   + <a href="/bugs/123" class="bug-link">bug no. 123</a><br />
   ? +++++++++++++++++
     bug#123<br />
   - <a href="/bugs/123">bug-123</a><br />
   + <a href="/bugs/123" class="bug-link">bug-123</a><br />
   ? ...

Revision history for this message
Benji York (benji) wrote :

This looks good.

review: Approve (code)
Revision history for this message
Benji York (benji) wrote :
Download full text (27.8 KiB)

There were some test failures:

Tests started at approximately 2011-08-22 15:14:33.722262
Source: bzr+ssh://bazaar.launchpad.net/~nigelbabu/launchpad/4595-upgrade-bug-linking r13583
Target: bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel/ r13755

15732 tests run in 4:05:03.916762, 2 failures, 10 errors

Failing tests
-------------
 lib/lp/app/doc/displaying-paragraphs-of-text.txt
 lp.app.browser.tests.test_stringformatter.TestLinkifyingBugs.test_explicit_bug_linkification

Tests with errors
-----------------
 lp.bugs.model.tests.test_bugtask.TestValidateTarget.test_new_sourcepackage_is_allowed
 lp.bugs.model.tests.test_bugtask.TestValidateTransitionToTarget.test_sourcepackage_to_sourcepackage_in_same_series_works
 lp.bugs.tests.test_structuralsubscription.TestGetStructuralSubscriptionTargets.test_sourcepackage_target
 lp.codehosting.scanner.tests.test_buglinks.TestBugLinking.test_ignoreNonExistentBug
 lp.codehosting.scanner.tests.test_buglinks.TestBugLinking.test_knownMainlineRevisionsDoesntMakeLink
 lp.codehosting.scanner.tests.test_buglinks.TestBugLinking.test_linking_bug_to_official_package_branch
 lp.codehosting.scanner.tests.test_buglinks.TestBugLinking.test_multipleBugsInProperty
 lp.codehosting.scanner.tests.test_buglinks.TestBugLinking.test_newMainlineRevisionAddsBugBranch
 lp.codehosting.scanner.tests.test_buglinks.TestBugLinking.test_nonMainlineRevisionsDontMakeBugBranches
 lp.codehosting.scanner.tests.test_buglinks.TestBugLinking.test_scanningTwiceDoesntMatter

======================================================================
FAILURE: lib/lp/app/doc/displaying-paragraphs-of-text.txt (subunit.RemotedTestCase)
----------------------------------------------------------------------
_StringException: Text attachment: traceback
------------
Traceback (most recent call last):
 File "/usr/lib/python2.6/unittest.py", line 279, in run
   testMethod()
 File "/usr/lib/python2.6/doctest.py", line 2152, in runTest
   raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for displaying-paragraphs-of-text.txt
 File "lib/lp/app/doc/displaying-paragraphs-of-text.txt", line 0

----------------------------------------------------------------------
File "lib/lp/app/doc/displaying-paragraphs-of-text.txt", line 536, in displaying-paragraphs-of-text.txt
Failed example:
   FormattersAPI._linkify_substitution(matchobj)
Differences (ndiff with -expected +actual):
   - '<a href="/bugs/2000">xxxx</a>'
   + '<a href="/bugs/2000" class="bug-link">xxxx</a>'
   ? +++++++++++++++++

------------

======================================================================
FAILURE: lp.app.browser.tests.test_stringformatter.TestLinkifyingBugs.test_explicit_bug_linkification (subunit.RemotedTestCase)
----------------------------------------------------------------------
_StringException: Text attachment: traceback
------------
Traceback (most recent call last):
_StringException: Traceback (most recent call last):
 File "/var/launchpad/test/lib/lp/app/browser/tests/test_stringformatter.py", line 150, in test_explicit_bug_linkification
   'LP: <a href="/bugs/10" class="bug-links">#10</a>',...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/app/browser/linkchecker.py'
2--- lib/lp/app/browser/linkchecker.py 2010-11-12 18:31:05 +0000
3+++ lib/lp/app/browser/linkchecker.py 2011-08-23 01:37:40 +0000
4@@ -11,6 +11,9 @@
5 import simplejson
6 from zope.component import getUtility
7
8+from canonical.launchpad.searchbuilder import any
9+from canonical.launchpad.webapp import LaunchpadView
10+
11 from lp.app.errors import NotFoundError
12 from lp.code.errors import (
13 CannotHaveLinkedBranch,
14@@ -19,10 +22,12 @@
15 NoSuchBranch,
16 )
17 from lp.code.interfaces.branchlookup import IBranchLookup
18+from lp.bugs.interfaces.bugtask import BugTaskSearchParams, IBugTaskSet
19+from lp.registry.interfaces.person import IPerson
20 from lp.registry.interfaces.product import InvalidProductName
21
22
23-class LinkCheckerAPI:
24+class LinkCheckerAPI(LaunchpadView):
25 """Validates Launchpad shortcut links.
26
27 This class provides the endpoint of an Ajax call to .../+check-links.
28@@ -47,6 +52,7 @@
29 # Each link type has it's own validation method.
30 self.link_checkers = dict(
31 branch_links=self.check_branch_links,
32+ bug_links=self.check_bug_links,
33 )
34
35 def __call__(self):
36@@ -78,6 +84,21 @@
37 invalid_links[link] = self._error_message(e)
38 return invalid_links
39
40+ def check_bug_links(self, links):
41+ """Checks links of the form /bugs/100"""
42+ invalid_links = {}
43+ user = self.user
44+ bugs = [int(link[len('/bugs/'):]) for link in links]
45+ if bugs:
46+ params = BugTaskSearchParams(
47+ user=user, status=None,
48+ bug=any(*bugs))
49+ bug_ids = getUtility(IBugTaskSet).searchBugIds(params)
50+ invalid = set(bugs) - set(bug_ids)
51+ for bug in invalid:
52+ invalid_links['/bugs/' + str(bug)] = "Bug %s cannot be found" % bug
53+ return invalid_links
54+
55 def _error_message(self, ex):
56 if hasattr(ex, 'display_message'):
57 return ex.display_message
58
59=== modified file 'lib/lp/app/browser/stringformatter.py'
60--- lib/lp/app/browser/stringformatter.py 2011-07-12 10:02:51 +0000
61+++ lib/lp/app/browser/stringformatter.py 2011-08-23 01:37:40 +0000
62@@ -283,7 +283,7 @@
63 # linkify to the general bug url.
64 url = '/bugs/%s' % bugnum
65 # The text will have already been cgi escaped.
66- return '<a href="%s">%s</a>%s' % (url, text, trailers)
67+ return '<a href="%s" class="bug-link">%s</a>%s' % (url, text, trailers)
68
69 @staticmethod
70 def _handle_parens_in_trailers(url, trailers):
71
72=== modified file 'lib/lp/app/browser/tests/test_linkchecker.py'
73--- lib/lp/app/browser/tests/test_linkchecker.py 2010-11-11 23:40:36 +0000
74+++ lib/lp/app/browser/tests/test_linkchecker.py 2011-08-23 01:37:40 +0000
75@@ -10,6 +10,7 @@
76 import simplejson
77 from zope.security.proxy import removeSecurityProxy
78
79+from canonical.launchpad.webapp import canonical_url
80 from canonical.launchpad.webapp.servers import LaunchpadTestRequest
81 from canonical.testing.layers import DatabaseFunctionalLayer
82 from lp.app.browser.linkchecker import LinkCheckerAPI
83@@ -28,7 +29,7 @@
84 self.assertEqual(len(invalid_links), len(links_to_check))
85 self.assertEqual(set(invalid_links), set(links_to_check))
86
87- def make_valid_links(self):
88+ def make_valid_branch_links(self):
89 branch = self.factory.makeProductBranch()
90 valid_branch_url = self.BRANCH_URL_TEMPLATE % branch.unique_name
91 product = self.factory.makeProduct()
92@@ -41,24 +42,45 @@
93 valid_product_url,
94 ]
95
96- def make_invalid_links(self):
97+ def make_invalid_branch_links(self):
98 return [
99 self.BRANCH_URL_TEMPLATE % 'foo',
100 self.BRANCH_URL_TEMPLATE % 'bar',
101 ]
102
103- def invoke_branch_link_checker(
104- self, valid_branch_urls=None, invalid_branch_urls=None):
105+ def make_valid_bug_links(self):
106+ bug = self.factory.makeBug()
107+ return ['/bugs/%d' % (bug.id)]
108+
109+ def make_invalid_bug_links(self):
110+ """
111+ As far as searchBugs() is concerned, this is an invalid bug to the
112+ currently authenticated user
113+ """
114+ bug_private = self.factory.makeBug(private=True)
115+ return ['/bugs/%d' % (bug_private.id)]
116+
117+ def invoke_link_checker(
118+ self, valid_branch_urls=None, invalid_branch_urls=None,
119+ valid_bug_urls=None, invalid_bug_urls=None):
120 if valid_branch_urls is None:
121 valid_branch_urls = {}
122 if invalid_branch_urls is None:
123 invalid_branch_urls = {}
124+ if valid_bug_urls is None:
125+ valid_bug_urls = {}
126+ if invalid_bug_urls is None:
127+ invalid_bug_urls = {}
128
129 branch_urls = list(valid_branch_urls)
130 branch_urls.extend(invalid_branch_urls)
131 shuffle(branch_urls)
132+
133+ bug_urls = list(valid_bug_urls)
134+ bug_urls.extend(invalid_bug_urls)
135+ shuffle(bug_urls)
136
137- links_to_check = dict(branch_links=branch_urls)
138+ links_to_check = dict(branch_links=branch_urls, bug_links=bug_urls)
139 link_json = simplejson.dumps(links_to_check)
140
141 request = LaunchpadTestRequest(link_hrefs=link_json)
142@@ -74,17 +96,23 @@
143 link_dict = simplejson.loads(result_json)
144 self.assertEqual(link_dict, {})
145
146- def test_only_valid_branchlinks(self):
147- branch_urls = self.make_valid_links()
148- self.invoke_branch_link_checker(valid_branch_urls=branch_urls)
149-
150- def test_only_invalid_branchlinks(self):
151- branch_urls = self.make_invalid_links()
152- self.invoke_branch_link_checker(invalid_branch_urls=branch_urls)
153-
154- def test_valid_and_invald_branchlinks(self):
155- valid_branch_urls = self.make_valid_links()
156- invalid_branch_urls = self.make_invalid_links()
157- self.invoke_branch_link_checker(
158+ def test_only_valid_links(self):
159+ branch_urls = self.make_valid_branch_links()
160+ bug_urls = self.make_valid_bug_links()
161+ self.invoke_link_checker(valid_branch_urls=branch_urls, valid_bug_urls=bug_urls)
162+
163+ def test_only_invalid_links(self):
164+ branch_urls = self.make_invalid_branch_links()
165+ bug_urls = self.make_invalid_bug_links()
166+ self.invoke_link_checker(invalid_branch_urls=branch_urls, invalid_bug_urls=bug_urls)
167+
168+ def test_valid_and_invald_links(self):
169+ valid_branch_urls = self.make_valid_branch_links()
170+ invalid_branch_urls = self.make_invalid_branch_links()
171+ valid_bug_urls = self.make_valid_bug_links()
172+ invalid_bug_urls = self.make_invalid_bug_links()
173+ self.invoke_link_checker(
174 valid_branch_urls=valid_branch_urls,
175- invalid_branch_urls=invalid_branch_urls)
176+ invalid_branch_urls=invalid_branch_urls,
177+ valid_bug_urls=valid_bug_urls,
178+ invalid_bug_urls=invalid_bug_urls)
179
180=== modified file 'lib/lp/app/browser/tests/test_stringformatter.py'
181--- lib/lp/app/browser/tests/test_stringformatter.py 2011-06-23 13:02:23 +0000
182+++ lib/lp/app/browser/tests/test_stringformatter.py 2011-08-23 01:37:40 +0000
183@@ -119,9 +119,9 @@
184 "bug number 34434",
185 ]
186 expected_html = [
187- '<p><a href="/bugs/34434">bug 34434</a></p>',
188- '<p><a href="/bugs/34434">bugnumber 34434</a></p>',
189- '<p><a href="/bugs/34434">bug number 34434</a></p>',
190+ '<p><a href="/bugs/34434" class="bug-link">bug 34434</a></p>',
191+ '<p><a href="/bugs/34434" class="bug-link">bugnumber 34434</a></p>',
192+ '<p><a href="/bugs/34434" class="bug-link">bug number 34434</a></p>',
193 ]
194 self.assertEqual(
195 expected_html,
196@@ -147,7 +147,7 @@
197 def test_explicit_bug_linkification(self):
198 text = 'LP: #10'
199 self.assertEqual(
200- 'LP: <a href="/bugs/10">#10</a>', linkify_bug_numbers(text))
201+ 'LP: <a href="/bugs/10" class="bug-link">#10</a>', linkify_bug_numbers(text))
202
203
204 class TestLinkifyingProtocols(TestCase):
205
206=== modified file 'lib/lp/app/browser/tests/test_webservice.py'
207--- lib/lp/app/browser/tests/test_webservice.py 2011-07-14 09:32:22 +0000
208+++ lib/lp/app/browser/tests/test_webservice.py 2011-08-23 01:37:40 +0000
209@@ -46,7 +46,7 @@
210 # The representation is linkified html.
211 self.assertEqual(
212 u'<p>\N{SNOWMAN} snowman@example.com '
213- '<a href="/bugs/1">bug 1</a></p>',
214+ '<a href="/bugs/1" class="bug-link">bug 1</a></p>',
215 renderer(text))
216
217
218
219=== modified file 'lib/lp/app/doc/displaying-paragraphs-of-text.txt'
220--- lib/lp/app/doc/displaying-paragraphs-of-text.txt 2011-06-23 13:10:40 +0000
221+++ lib/lp/app/doc/displaying-paragraphs-of-text.txt 2011-08-23 01:37:40 +0000
222@@ -225,40 +225,40 @@
223 ... '#123\n'
224 ... 'debug #52\n')
225 >>> print test_tales('foo/fmt:text-to-html', foo=text)
226- <p><a href="/bugs/123">bug 123</a><br />
227- <a href="/bugs/123">bug 123</a><br />
228- <a href="/bugs/123">bug #123</a><br />
229- <a href="/bugs/123">bug number 123</a><br />
230+ <p><a href="/bugs/123" class="bug-link">bug 123</a><br />
231+ <a href="/bugs/123" class="bug-link">bug 123</a><br />
232+ <a href="/bugs/123" class="bug-link">bug #123</a><br />
233+ <a href="/bugs/123" class="bug-link">bug number 123</a><br />
234 bug number. 123<br />
235- <a href="/bugs/123">bug num 123</a><br />
236- <a href="/bugs/123">bug num. 123</a><br />
237- <a href="/bugs/123">bug no 123</a><br />
238- <a href="/bugs/123">bug report 123</a><br />
239- <a href="/bugs/123">bug no. 123</a><br />
240+ <a href="/bugs/123" class="bug-link">bug num 123</a><br />
241+ <a href="/bugs/123" class="bug-link">bug num. 123</a><br />
242+ <a href="/bugs/123" class="bug-link">bug no 123</a><br />
243+ <a href="/bugs/123" class="bug-link">bug report 123</a><br />
244+ <a href="/bugs/123" class="bug-link">bug no. 123</a><br />
245 bug#123<br />
246- <a href="/bugs/123">bug-123</a><br />
247- <a href="/bugs/123">bug-report-123</a><br />
248- <a href="/bugs/123">bug=123</a><br />
249- <a href="/bugs/123">bug<br /> #123</a><br />
250+ <a href="/bugs/123" class="bug-link">bug-123</a><br />
251+ <a href="/bugs/123" class="bug-link">bug-report-123</a><br />
252+ <a href="/bugs/123" class="bug-link">bug=123</a><br />
253+ <a href="/bugs/123" class="bug-link">bug<br /> #123</a><br />
254 debug #52</p>
255
256 >>> text = (
257 ... 'bug 123\n'
258 ... 'bug 123\n')
259 >>> print test_tales('foo/fmt:text-to-html', foo=text)
260- <p><a href="/bugs/123">bug 123</a><br />
261- <a href="/bugs/123">bug 123</a></p>
262+ <p><a href="/bugs/123" class="bug-link">bug 123</a><br />
263+ <a href="/bugs/123" class="bug-link">bug 123</a></p>
264
265 >>> text = (
266 ... 'bug 1234\n'
267 ... 'bug 123\n')
268 >>> print test_tales('foo/fmt:text-to-html', foo=text)
269- <p><a href="/bugs/1234">bug 1234</a><br />
270- <a href="/bugs/123">bug 123</a></p>
271+ <p><a href="/bugs/1234" class="bug-link">bug 1234</a><br />
272+ <a href="/bugs/123" class="bug-link">bug 123</a></p>
273
274 >>> text = 'bug 0123\n'
275 >>> print test_tales('foo/fmt:text-to-html', foo=text)
276- <p><a href="/bugs/123">bug 0123</a></p>
277+ <p><a href="/bugs/123" class="bug-link">bug 0123</a></p>
278
279
280 We linkify bugs that are in the Ubuntu convention for referring to bugs in
281@@ -266,26 +266,26 @@
282
283 >>> text = 'LP: #123.\n'
284 >>> print test_tales('foo/fmt:text-to-html', foo=text)
285- <p>LP: <a href="/bugs/123">#123</a>.</p>
286+ <p>LP: <a href="/bugs/123" class="bug-link">#123</a>.</p>
287
288 Works with multiple bugs:
289
290 >>> text = 'LP: #123, #2.\n'
291 >>> print test_tales('foo/fmt:text-to-html', foo=text)
292- <p>LP: <a href="/bugs/123">#123</a>, <a href="/bugs/2">#2</a>.</p>
293+ <p>LP: <a href="/bugs/123" class="bug-link">#123</a>, <a href="/bugs/2" class="bug-link">#2</a>.</p>
294
295 And with lower case 'lp' too:
296
297 >>> text = 'lp: #123, #2.\n'
298 >>> print test_tales('foo/fmt:text-to-html', foo=text)
299- <p>lp: <a href="/bugs/123">#123</a>, <a href="/bugs/2">#2</a>.</p>
300+ <p>lp: <a href="/bugs/123" class="bug-link">#123</a>, <a href="/bugs/2" class="bug-link">#2</a>.</p>
301
302 Even line breaks cannot stop the power of bug linking:
303
304 >>> text = 'LP: #123,\n#2.\n'
305 >>> print test_tales('foo/fmt:text-to-html', foo=text)
306- <p>LP: <a href="/bugs/123">#123</a>,<br />
307- <a href="/bugs/2">#2</a>.</p>
308+ <p>LP: <a href="/bugs/123" class="bug-link">#123</a>,<br />
309+ <a href="/bugs/2" class="bug-link">#2</a>.</p>
310
311 To check a private bug, we need to log in and set a bug to be private.
312
313@@ -308,7 +308,7 @@
314
315 >>> text = 'bug 6\n'
316 >>> print test_tales('foo/fmt:text-to-html', foo=text)
317- <p><a href="/bugs/6">bug 6</a></p>
318+ <p><a href="/bugs/6" class="bug-link">bug 6</a></p>
319
320
321 == FAQ references ==
322@@ -374,14 +374,14 @@
323
324 >>> text = 'lp:1234'
325 >>> print test_tales('foo/fmt:text-to-html', foo=text)
326- <p><a href="/bugs/1234">lp:1234</a></p>
327+ <p><a href="/bugs/1234" class="bug-link">lp:1234</a></p>
328
329 We are even smart enough to notice the trailing punctuation gunk and separate
330 that from the link.
331
332 >>> text = 'lp:1234,'
333 >>> print test_tales('foo/fmt:text-to-html', foo=text)
334- <p><a href="/bugs/1234">lp:1234</a>,</p>
335+ <p><a href="/bugs/1234" class="bug-link">lp:1234</a>,</p>
336
337
338 == OOPS references ==
339@@ -524,7 +524,7 @@
340 >>> sorted(matchobj.groupdict().items())
341 [('bug', 'xxxx'), ('bugnum', '2'), ('url', None)]
342 >>> FormattersAPI._linkify_substitution(matchobj)
343- '<a href="/bugs/2">xxxx</a>'
344+ '<a href="/bugs/2" class="bug-link">xxxx</a>'
345
346 When the bugnum doesn't match any bug, we still get a link, but get a message
347 in the link's title.
348@@ -534,4 +534,4 @@
349 >>> sorted(matchobj.groupdict().items())
350 [('bug', 'xxxx'), ('bugnum', '2000'), ('url', None)]
351 >>> FormattersAPI._linkify_substitution(matchobj)
352- '<a href="/bugs/2000">xxxx</a>'
353+ '<a href="/bugs/2000" class="bug-link">xxxx</a>'
354
355=== modified file 'lib/lp/app/javascript/lp-links.js'
356--- lib/lp/app/javascript/lp-links.js 2011-02-24 00:23:04 +0000
357+++ lib/lp/app/javascript/lp-links.js 2011-08-23 01:37:40 +0000
358@@ -58,6 +58,7 @@
359 // We get all the links with defined css classes.
360 // At the moment, we just handle branch links, but in future...
361 harvest_links(links_to_check, 'branch-short-link', 'branch_links');
362+ harvest_links(links_to_check, 'bug-link', 'bug_links');
363
364 // Do we have anything to do?
365 if( Y.Object.size(links_to_check) == 0 ) {
366@@ -85,6 +86,8 @@
367 // ATM, we just handle branch links, but in future...
368 process_invalid_links(link_info, 'branch-short-link',
369 'branch_links');
370+ process_invalid_links(link_info, 'bug-link',
371+ 'bug_links');
372 }
373 }
374 }
375
376=== modified file 'lib/lp/bugs/tests/test_bugs_webservice.py'
377--- lib/lp/bugs/tests/test_bugs_webservice.py 2011-05-27 14:07:42 +0000
378+++ lib/lp/bugs/tests/test_bugs_webservice.py 2011-08-23 01:37:40 +0000
379@@ -108,7 +108,7 @@
380 self.assertEqual(
381 self.findBugDescription(response),
382 u'<p>Useless bugs are useless. '
383- 'See <a href="/bugs/%d">Bug %d</a>.</p>' % (
384+ 'See <a href="/bugs/%d" class="bug-link">Bug %d</a>.</p>' % (
385 self.bug_one.id, self.bug_one.id))
386
387 def test_PATCH_xhtml_representation(self):
388@@ -127,7 +127,7 @@
389
390 self.assertEqual(
391 self.findBugDescription(response),
392- u'<p>See <a href="/bugs/%d">bug %d</a></p>' % (
393+ u'<p>See <a href="/bugs/%d" class="bug-link">bug %d</a></p>' % (
394 self.bug_one.id, self.bug_one.id))
395
396
397
398=== modified file 'lib/lp/soyuz/stories/soyuz/xx-sourcepackage-changelog.txt'
399--- lib/lp/soyuz/stories/soyuz/xx-sourcepackage-changelog.txt 2011-05-13 03:26:21 +0000
400+++ lib/lp/soyuz/stories/soyuz/xx-sourcepackage-changelog.txt 2011-08-23 01:37:40 +0000
401@@ -104,8 +104,8 @@
402 <pre ... id="alsa-utils_1.0.9a-4ubuntu1">alsa-utils (1.0.9a-4ubuntu1) ...
403 <BLANKLINE>
404 ...
405- LP: <a href="/bugs/10">#10</a>
406- LP: <a href="/bugs/999">#999</a>
407+ LP: <a href="/bugs/10" class="bug-link">#10</a>
408+ LP: <a href="/bugs/999" class="bug-link">#999</a>
409 LP: #badid
410 ...
411