← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~thumper/launchpad/remove-webservice-xhtml-span into lp:launchpad

 

Tim Penhey has proposed merging lp:~thumper/launchpad/remove-webservice-xhtml-span into lp:launchpad with lp:~thumper/launchpad/webservice-person-adapter as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #704651 Person xhtml representation adds a <span>
  https://bugs.launchpad.net/bugs/704651

For more details, see:
https://code.launchpad.net/~thumper/launchpad/remove-webservice-xhtml-span/+merge/46686

Remove the span in the XHTML representation and add it in the Javascript processing.
-- 
https://code.launchpad.net/~thumper/launchpad/remove-webservice-xhtml-span/+merge/46686
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~thumper/launchpad/remove-webservice-xhtml-span into lp:launchpad.
=== modified file 'lib/lp/app/javascript/picker.js'
--- lib/lp/app/javascript/picker.js	2010-11-05 17:13:49 +0000
+++ lib/lp/app/javascript/picker.js	2011-01-18 21:52:59 +0000
@@ -93,7 +93,9 @@
                 } else if (element.get('tagName') == 'DD') {
                     if (current_field == attribute_name) {
                         // The field value is found
-                        success_message_node = element.one('span');
+                        success_message_node = Y.Node.create('<span></span>');
+                        rendered_field = element.get('innerHTML');
+                        success_mesage_node.appendChild(rendered_field);
                     } else if (current_field == 'self_link') {
                         picker._resource_uri = element.get('innerHTML');
                     }

=== modified file 'lib/lp/registry/browser/tests/test_webservice.py'
--- lib/lp/registry/browser/tests/test_webservice.py	2011-01-18 21:52:59 +0000
+++ lib/lp/registry/browser/tests/test_webservice.py	2011-01-18 21:52:59 +0000
@@ -30,8 +30,7 @@
         renderer = getMultiAdapter(
             (product, field, request), IFieldHTMLRenderer)
         # The representation of a person is the same as a tales PersonFormatter.
-        self.assertEqual(
-            '<span>%s</span>' % format_link(eric), renderer(eric))
+        self.assertEqual(format_link(eric), renderer(eric))
 
     def test_text(self):
         # Test the XHTML representation of a text field.

=== modified file 'lib/lp/registry/browser/webservice.py'
--- lib/lp/registry/browser/webservice.py	2011-01-18 21:52:59 +0000
+++ lib/lp/registry/browser/webservice.py	2011-01-18 21:52:59 +0000
@@ -33,12 +33,7 @@
         if person is None:
             return ''
         else:
-            link = PersonFormatterAPI(person).link(None)
-            # This span is required for now as it is used in the parsing of
-            # the dt list returned by default as the xhtml representation.  To
-            # remove this, you need to fix the javascript parsing in
-            # lp.app.javascript.picker (we think).
-            return '<span>%s</span>' % link
+            return PersonFormatterAPI(person).link(None)
     return render