Merge ~cjwatson/launchpad:po-export-https into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 45f15a6eb0d42f19af304e4c193f6d3ded022f03
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:po-export-https
Merge into: launchpad:master
Diff against target: 40 lines (+9/-2)
2 files modified
lib/lp/translations/scripts/po_export_queue.py (+1/-1)
lib/lp/translations/tests/test_exportresult.py (+8/-1)
Reviewer Review Type Date Requested Status
Thiago F. Pappacena (community) Approve
Review via email: mp+380475@code.launchpad.net

Commit message

Send HTTPS URLs in translation export emails

Description of the change

These were originally HTTP due to performance concerns, but those concerns became obsolete quite some time ago.

To post a comment you must log in.
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/translations/scripts/po_export_queue.py b/lib/lp/translations/scripts/po_export_queue.py
2index c66f93d..f8bcf9b 100644
3--- a/lib/lp/translations/scripts/po_export_queue.py
4+++ b/lib/lp/translations/scripts/po_export_queue.py
5@@ -291,7 +291,7 @@ class ExportResult:
6 name=path, size=self.exported_file.size, file=self.exported_file,
7 contentType=self.exported_file.content_type)
8
9- self.url = alias.http_url
10+ self.url = alias.getURL()
11 if logger is not None:
12 logger.info("Stored file at %s" % self.url)
13
14diff --git a/lib/lp/translations/tests/test_exportresult.py b/lib/lp/translations/tests/test_exportresult.py
15index 77d5129..4d26a86 100644
16--- a/lib/lp/translations/tests/test_exportresult.py
17+++ b/lib/lp/translations/tests/test_exportresult.py
18@@ -36,6 +36,13 @@ class TestExportResult(TestCaseWithFactory):
19
20 layer = ZopelessDatabaseLayer
21
22+ def setUp(self):
23+ super(TestExportResult, self).setUp()
24+ # In development mode, the librarian is normally configured to
25+ # generate HTTP URLs. Enable HTTPS URLs so that we can test that
26+ # ExportResult uses them.
27+ self.pushConfig("librarian", use_https=True)
28+
29 def makeExportResult(self):
30 request = [self.factory.makePOFile()]
31 requester = self.factory.makePerson()
32@@ -55,7 +62,7 @@ class TestExportResult(TestCaseWithFactory):
33 export_result.setExportFile(export)
34 export_result.upload()
35
36- self.assertIsNot(None, export_result.url)
37+ self.assertStartsWith(export_result.url, "https://")
38 sha256 = hashlib.sha256(export.content).hexdigest()
39 self.assertEqual(sha256, librarian.aliases.values()[0].content.sha256)
40 alias = librarian.findBySHA256(sha256)

Subscribers

People subscribed via source and target branches

to status/vote changes: