launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26458
[Merge] ~cjwatson/launchpad:py3-xmlrpc-validation-errors into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-xmlrpc-validation-errors into launchpad:master.
Commit message:
Stop encoding validation errors in codehosting XML-RPC API
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398813
xmlrpclib/xmlrpc.client doesn't require this to be encoded, and it causes test failures on Python 3.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-xmlrpc-validation-errors into launchpad:master.
diff --git a/lib/lp/code/xmlrpc/codehosting.py b/lib/lp/code/xmlrpc/codehosting.py
index 3c09e78..9e018ee 100644
--- a/lib/lp/code/xmlrpc/codehosting.py
+++ b/lib/lp/code/xmlrpc/codehosting.py
@@ -242,7 +242,7 @@ class CodehostingAPI(LaunchpadXMLRPCView):
branch = namespace.createBranch(
BranchType.HOSTED, branch_name, requester)
except LaunchpadValidationError as e:
- return faults.PermissionDenied(six.ensure_binary(e.args[0]))
+ return faults.PermissionDenied(e.args[0])
except BranchCreationException as e:
return faults.PermissionDenied(str(e))
diff --git a/lib/lp/code/xmlrpc/tests/test_codehosting.py b/lib/lp/code/xmlrpc/tests/test_codehosting.py
index 99a9cd1..9277370 100644
--- a/lib/lp/code/xmlrpc/tests/test_codehosting.py
+++ b/lib/lp/code/xmlrpc/tests/test_codehosting.py
@@ -397,8 +397,7 @@ class CodehostingTest(WithScenarios, TestCaseWithFactory):
# always HTML, so it ends up double-escaped in XML-RPC faults.
message = html_escape(
"Invalid branch name '%s'. %s"
- % (invalid_name, BRANCH_NAME_VALIDATION_ERROR_MESSAGE)
- ).encode('utf-8')
+ % (invalid_name, BRANCH_NAME_VALIDATION_ERROR_MESSAGE))
fault = self.codehosting_api.createBranch(
owner.id, escape(
'/~%s/%s/%s' % (owner.name, product.name, invalid_name)))
diff --git a/lib/lp/codehosting/inmemory.py b/lib/lp/codehosting/inmemory.py
index 4de60fd..54ac995 100644
--- a/lib/lp/codehosting/inmemory.py
+++ b/lib/lp/codehosting/inmemory.py
@@ -718,7 +718,7 @@ class FakeCodehosting:
except LaunchpadFault as e:
return e
except LaunchpadValidationError as e:
- return faults.PermissionDenied(six.ensure_binary(e.args[0]))
+ return faults.PermissionDenied(e.args[0])
def requestMirror(self, requester_id, branch_id):
self._branch_set.get(branch_id).requestMirror()