← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~pappacena/turnip:py3-mp-url-hint into turnip:master

 

Thiago F. Pappacena has proposed merging ~pappacena/turnip:py3-mp-url-hint into turnip:master.

Commit message:
Making getMergeProposalURL compatible with python3

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pappacena/turnip/+git/turnip/+merge/395339

If we send the branch or the repo as a binary data, Launchpad breaks and returns us an error, preventing us from showing the MP URL hint. This MP fixes this problem.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~pappacena/turnip:py3-mp-url-hint into turnip:master.
diff --git a/turnip/pack/hookrpc.py b/turnip/pack/hookrpc.py
index 83cbf91..15f5187 100644
--- a/turnip/pack/hookrpc.py
+++ b/turnip/pack/hookrpc.py
@@ -252,9 +252,9 @@ class HookRPCHandler(object):
     @defer.inlineCallbacks
     def getMergeProposalURL(self, proto, args):
         log_context = HookRPCLogContext(self.auth_params[args['key']])
-        path = self.ref_paths[args['key']]
+        path = six.ensure_text(self.ref_paths[args['key']])
         auth_params = self.auth_params[args['key']]
-        branch = args['branch']
+        branch = six.ensure_text(args['branch'])
         log_context.log.info(
             "getMergeProposalURL request received: ref_path={path}", path=path)
         mp_url = None
diff --git a/turnip/pack/tests/fake_servers.py b/turnip/pack/tests/fake_servers.py
index 7087da9..8ed152d 100644
--- a/turnip/pack/tests/fake_servers.py
+++ b/turnip/pack/tests/fake_servers.py
@@ -126,6 +126,10 @@ class FakeVirtInfoService(xmlrpc.XMLRPC):
         if self.merge_proposal_url_fault is not None:
             raise self.merge_proposal_url_fault
         else:
+            # Launchpad fails if these parameters are binary. So, replicate
+            # this behavior with a couple of asserts.
+            assert isinstance(path, six.string_types)
+            assert isinstance(branch, six.string_types)
             return self.merge_proposal_url
 
     def xmlrpc_confirmRepoCreation(self, pathname, auth_params):