launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #17299
[Merge] lp:~cjohnston/launchpad/900216 into lp:launchpad
Chris Johnston has proposed merging lp:~cjohnston/launchpad/900216 into lp:launchpad.
Commit message:
Support unicode in PPAUploadPathError's
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjohnston/launchpad/900216/+merge/229659
--
https://code.launchpad.net/~cjohnston/launchpad/900216/+merge/229659
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjohnston/launchpad/900216 into lp:launchpad.
=== modified file 'lib/lp/archiveuploader/tests/test_ppauploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2014-07-09 06:34:14 +0000
+++ lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2014-08-05 16:21:10 +0000
@@ -1011,6 +1011,40 @@
"File bar_1.0.orig.tar.gz already exists in unicode PPA name: "
"áří" in body)
+ def testErrorMessagesWithArchiveDisplayNameUnicodeArchiveDisabled(self):
+ """Check that unicode errors messages are handled correctly.
+
+ Some error messages can contain the PPA display name, which may
+ sometimes contain unicode characters. We need to show proper errors
+ when a disabled PPA with a unicode display name gets an upload.
+ """
+ # Ensure the displayname of the PPA has got unicode in it.
+ self.name16.archive.displayname = u"unicode PPA name: áří"
+ self.name16.archive.disable()
+ # Upload the first version.
+ upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu")
+ self.processUpload(self.uploadprocessor, upload_dir)
+
+ # The error message should be sane, and not one about unicode
+ # errors.
+ # Also, the email generated should be sane.
+ from_addr, to_addrs, raw_msg = stub.test_emails.pop()
+ msg = message_from_string(raw_msg)
+ body = msg.get_payload(0)
+ body = body.get_payload(decode=True)
+
+ self.assertTrue(
+ "Rejected:\n"
+ "Launchpad failed to process the upload path '~name16/ubuntu':\n\n"
+ "unicode PPA name: áří is disabled.\n\n"
+ "It is likely that you have a configuration problem with "
+ "dput/dupload.\n"
+ "Please check the documentation at "
+ "https://help.launchpad.net/Packaging/PPA#Uploading and update "
+ "your configuration.\n\n"
+ "Further error processing not possible because of a critical "
+ "previous error." in body)
+
def testPPAConflictingOrigFiles(self):
"""When available, the official 'orig.tar.gz' restricts PPA uploads.
=== modified file 'lib/lp/archiveuploader/uploadprocessor.py'
--- lib/lp/archiveuploader/uploadprocessor.py 2014-07-07 02:46:56 +0000
+++ lib/lp/archiveuploader/uploadprocessor.py 2014-08-05 16:21:10 +0000
@@ -350,8 +350,9 @@
# enough). On the other hand if we set an arbitrary owner it
# will break nascentupload ACL calculations.
archive = distribution.getAllPPAs()[0]
+ msg = ("".join(e.args))
upload_path_error = UPLOAD_PATH_ERROR_TEMPLATE % (
- dict(upload_path=relative_path, path_error=str(e),
+ dict(upload_path=relative_path, path_error=msg,
extra_info=(
"Please check the documentation at "
"https://help.launchpad.net/Packaging/PPA#Uploading "
Follow ups