← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~gmb/launchpad/prevent-dustins-head-exploding-bug-558419 into lp:launchpad

 

Graham Binns has proposed merging lp:~gmb/launchpad/prevent-dustins-head-exploding-bug-558419 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #691076 Links in bug reporting guidelines should have target="_new"
  https://bugs.launchpad.net/bugs/691076


This branch fixes an issue with filing bugs on targets that have links
in their bug filing guidelines. The widgets on the bug filing form have
no tabindices, so links in the guidelines are included in the tab path
from the "bug details" field to the "submit" button. Accidentally
hitting one of these links takes you away from the page, which is
undesirable.

The solution to this (aside from adding tabindices, which is being
tracked in another bug) is to make the links in the bug filing
guidelines open in a new window. To this end, I've created a new
formatter that adds the target="_new" attribute to all links in the bug
reporting guidelines.

== lib/lp/app/browser/stringformatter.py ==

 - I've added a staticmethod, _linkify_substitution_with_target() to
   FormattersAPI. This calls the _linkify_substitution() method and then
   uses lxml to add the target="_new" attribute to the links in whatever
   that method returns.
 - I've made the majority of the text_to_html formatter into a method
   called _htmlify_text(), which is called by text_to_html and
   text_to_html_with_target (below).
 - I've added a text_to_html_with_target formatter which uses the
   _htmlify_text() method and the _linkify_substitution_with_target()
   staticmethod to HTMLify text with target="_new" for all the links.

== lib/lp/app/tests/test_tales.py ==

 - I've added a unittest to cover the new formatter.

== lib/lp/bugs/stories/guided-filebug/xx-bug-reporting-guidelines.txt ==

 - I've updated the existing pagetests to show that links in the bug
   reporting guidelines have a target of "_new".

== lib/lp/bugs/templates/bugtarget-macros-filebug.pt ==

 - I've updated the template to use the new formatter.
-- 
https://code.launchpad.net/~gmb/launchpad/prevent-dustins-head-exploding-bug-558419/+merge/44042
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gmb/launchpad/prevent-dustins-head-exploding-bug-558419 into lp:launchpad.