← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-pofile-translate-view into launchpad:master.

Commit message:
Fix POFileTranslateView for Python 3

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

On Python 3, str() already returns text.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-pofile-translate-view into launchpad:master.
diff --git a/lib/lp/translations/browser/pofile.py b/lib/lp/translations/browser/pofile.py
index e7c80a2..5f45a44 100644
--- a/lib/lp/translations/browser/pofile.py
+++ b/lib/lp/translations/browser/pofile.py
@@ -19,6 +19,7 @@ import os.path
 import re
 
 from lazr.restful.utils import smartquote
+import six
 from six.moves.urllib.parse import urlencode
 from zope.component import getUtility
 from zope.publisher.browser import FileUpload
@@ -561,7 +562,7 @@ class POFileTranslateView(BaseTranslationView, POFileMetadataViewMixin):
         translations_person = ITranslationsPerson(self.user, None)
         if (self.user is not None and
             translations_person.translations_relicensing_agreement is None):
-            url = str(self.request.URL).decode('US-ASCII', 'replace')
+            url = six.ensure_text(str(self.request.URL), 'US-ASCII', 'replace')
             if self.request.get('QUERY_STRING', None):
                 url = url + '?' + self.request['QUERY_STRING']