← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-print-location into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-print-location into launchpad:master.

Commit message:
Remove unnecessary encoding from print_location

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/396828

There's also a partial borrowed copy in hierarchical-menu.txt.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-print-location into launchpad:master.
diff --git a/lib/lp/app/doc/hierarchical-menu.txt b/lib/lp/app/doc/hierarchical-menu.txt
index d9d2af0..e9f411e 100644
--- a/lib/lp/app/doc/hierarchical-menu.txt
+++ b/lib/lp/app/doc/hierarchical-menu.txt
@@ -256,8 +256,7 @@ location bar.
     ...     soup = BeautifulSoup(html)
     ...     hierarchy = soup.find(attrs={'class': 'breadcrumbs'}).findAll(
     ...         recursive=False)
-    ...     segments = [extract_text(step).encode('us-ascii', 'replace')
-    ...                 for step in hierarchy]
+    ...     segments = [extract_text(step) for step in hierarchy]
     ...     print('Location:', ' > '.join(segments))
 
     >>> markup = hierarchy.render()
diff --git a/lib/lp/registry/stories/team-polls/create-polls.txt b/lib/lp/registry/stories/team-polls/create-polls.txt
index ab9d1f5..08120dd 100644
--- a/lib/lp/registry/stories/team-polls/create-polls.txt
+++ b/lib/lp/registry/stories/team-polls/create-polls.txt
@@ -112,7 +112,7 @@ We're redirected to the newly created poll
     >>> team_admin_browser.title
     'Debian Project Leader Election 2080 : \xe2\x80\x9cUbuntu Team\xe2\x80\x9d team'
     >>> print_location(team_admin_browser.contents)
-    Hierarchy:  ?Ubuntu Team? team
+    Hierarchy: “Ubuntu Team” team
     Tabs:
     * Overview (selected) - http://launchpad.test/~ubuntu-team
     * Code - http://code.launchpad.test/~ubuntu-team
diff --git a/lib/lp/testing/pages.py b/lib/lp/testing/pages.py
index e620147..109551c 100644
--- a/lib/lp/testing/pages.py
+++ b/lib/lp/testing/pages.py
@@ -573,8 +573,7 @@ def print_location(contents):
     heading = doc.find(attrs={'id': 'watermark-heading'}).findAll('a')
     container = doc.find(attrs={'class': 'breadcrumbs'})
     hierarchy = container.findAll(recursive=False) if container else []
-    segments = [extract_text(step).encode('us-ascii', 'replace')
-                for step in chain(heading, hierarchy)]
+    segments = [extract_text(step) for step in chain(heading, hierarchy)]
 
     if len(segments) == 0:
         breadcrumbs = 'None displayed'
@@ -586,8 +585,7 @@ def print_location(contents):
     print_location_apps(contents)
     main_heading = doc.h1
     if main_heading:
-        main_heading = extract_text(main_heading).encode(
-            'us-ascii', 'replace')
+        main_heading = extract_text(main_heading)
     else:
         main_heading = '(No main heading)'
     print("Main heading: %s" % main_heading)