Merge lp:~cjohnston/launchpad/900216 into lp:launchpad

Proposed by Chris Johnston
Status: Merged
Merged at revision: 17152
Proposed branch: lp:~cjohnston/launchpad/900216
Merge into: lp:launchpad
Diff against target: 55 lines (+33/-1)
2 files modified
lib/lp/archiveuploader/tests/test_ppauploadprocessor.py (+32/-0)
lib/lp/archiveuploader/uploadprocessor.py (+1/-1)
To merge this branch: bzr merge lp:~cjohnston/launchpad/900216
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+229659@code.launchpad.net

Commit message

Support unicode in PPAUploadPathError's

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

That's a bit of a hack. We only ever raise an UploadPathError with a single argument that's either an ASCII str or a unicode, so I'd just use e.args[0] in place of str(e).

review: Needs Fixing (code)
Revision history for this message
Chris Johnston (cjohnston) wrote :

Updated

Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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-06 13:21:32 +0000
@@ -1011,6 +1011,38 @@
1011 "File bar_1.0.orig.tar.gz already exists in unicode PPA name: "1011 "File bar_1.0.orig.tar.gz already exists in unicode PPA name: "
1012 "áří" in body)1012 "áří" in body)
10131013
1014 def testErrorMessagesWithArchiveDisplayNameUnicodeArchiveDisabled(self):
1015 """Check that unicode errors messages are handled correctly.
1016
1017 Some error messages can contain the PPA display name, which may
1018 sometimes contain unicode characters. We need to show proper errors
1019 when a disabled PPA with a unicode display name gets an upload.
1020 """
1021 # Ensure the displayname of the PPA has got unicode in it.
1022 self.name16.archive.displayname = u"unicode PPA name: áří"
1023 self.name16.archive.disable()
1024 # Upload to disabled archive.
1025 upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu")
1026 self.processUpload(self.uploadprocessor, upload_dir)
1027
1028 # The email generated should be sane.
1029 from_addr, to_addrs, raw_msg = stub.test_emails.pop()
1030 msg = message_from_string(raw_msg)
1031 body = msg.get_payload(0)
1032 body = body.get_payload(decode=True)
1033
1034 self.assertTrue(
1035 "Rejected:\n"
1036 "Launchpad failed to process the upload path '~name16/ubuntu':\n\n"
1037 "unicode PPA name: áří is disabled.\n\n"
1038 "It is likely that you have a configuration problem with "
1039 "dput/dupload.\n"
1040 "Please check the documentation at "
1041 "https://help.launchpad.net/Packaging/PPA#Uploading and update "
1042 "your configuration.\n\n"
1043 "Further error processing not possible because of a critical "
1044 "previous error." in body)
1045
1014 def testPPAConflictingOrigFiles(self):1046 def testPPAConflictingOrigFiles(self):
1015 """When available, the official 'orig.tar.gz' restricts PPA uploads.1047 """When available, the official 'orig.tar.gz' restricts PPA uploads.
10161048
10171049
=== 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-06 13:21:32 +0000
@@ -351,7 +351,7 @@
351 # will break nascentupload ACL calculations.351 # will break nascentupload ACL calculations.
352 archive = distribution.getAllPPAs()[0]352 archive = distribution.getAllPPAs()[0]
353 upload_path_error = UPLOAD_PATH_ERROR_TEMPLATE % (353 upload_path_error = UPLOAD_PATH_ERROR_TEMPLATE % (
354 dict(upload_path=relative_path, path_error=str(e),354 dict(upload_path=relative_path, path_error=e.args[0],
355 extra_info=(355 extra_info=(
356 "Please check the documentation at "356 "Please check the documentation at "
357 "https://help.launchpad.net/Packaging/PPA#Uploading "357 "https://help.launchpad.net/Packaging/PPA#Uploading "