Merge ~cjwatson/launchpad:py3-pofile-translate-view into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: af59afdc8fc489c908088b1dd547028ecb4ed3dc
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:py3-pofile-translate-view
Merge into: launchpad:master
Diff against target: 20 lines (+2/-1)
1 file modified
lib/lp/translations/browser/pofile.py (+2/-1)
Reviewer Review Type Date Requested Status
Cristian Gonzalez (community) Approve
Review via email: mp+398988@code.launchpad.net

Commit message

Fix POFileTranslateView for Python 3

Description of the change

On Python 3, str() already returns text.

To post a comment you must log in.
Revision history for this message
Cristian Gonzalez (cristiangsp) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/translations/browser/pofile.py b/lib/lp/translations/browser/pofile.py
2index e7c80a2..5f45a44 100644
3--- a/lib/lp/translations/browser/pofile.py
4+++ b/lib/lp/translations/browser/pofile.py
5@@ -19,6 +19,7 @@ import os.path
6 import re
7
8 from lazr.restful.utils import smartquote
9+import six
10 from six.moves.urllib.parse import urlencode
11 from zope.component import getUtility
12 from zope.publisher.browser import FileUpload
13@@ -561,7 +562,7 @@ class POFileTranslateView(BaseTranslationView, POFileMetadataViewMixin):
14 translations_person = ITranslationsPerson(self.user, None)
15 if (self.user is not None and
16 translations_person.translations_relicensing_agreement is None):
17- url = str(self.request.URL).decode('US-ASCII', 'replace')
18+ url = six.ensure_text(str(self.request.URL), 'US-ASCII', 'replace')
19 if self.request.get('QUERY_STRING', None):
20 url = url + '?' + self.request['QUERY_STRING']
21

Subscribers

People subscribed via source and target branches

to status/vote changes: