launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #30231
[Merge] ~cjwatson/launchpad:fix-stormify-pofile into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-stormify-pofile into launchpad:master.
Commit message:
Fix regression from converting POFile to Storm
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/446641
The PO export views pass IDs to `POExportRequestSet.addRequest` (probably for performance), so it needs to preserve the ability to accept either database model objects or IDs.
This exposed one test that was passing a `POTemplate` in the `pofiles` argument, apparently by accident.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-stormify-pofile into launchpad:master.
diff --git a/lib/lp/translations/doc/poexport-request.rst b/lib/lp/translations/doc/poexport-request.rst
index 3b6df66..cede80c 100644
--- a/lib/lp/translations/doc/poexport-request.rst
+++ b/lib/lp/translations/doc/poexport-request.rst
@@ -182,9 +182,7 @@ Let's try requesting an export in MO format:
>>> from lp.translations.interfaces.translationfileformat import (
... TranslationFileFormat,
... )
- >>> request_set.addRequest(
- ... person, None, [cs, cs.potemplate], TranslationFileFormat.MO
- ... )
+ >>> request_set.addRequest(person, None, [cs], TranslationFileFormat.MO)
>>> transaction.commit()
>>> process_queue(transaction, FakeLogger())
DEBUG Exporting objects for Happy Downloader, related to template pmount
diff --git a/lib/lp/translations/model/poexportrequest.py b/lib/lp/translations/model/poexportrequest.py
index a346930..3313457 100644
--- a/lib/lp/translations/model/poexportrequest.py
+++ b/lib/lp/translations/model/poexportrequest.py
@@ -25,6 +25,7 @@ from lp.translations.interfaces.poexportrequest import (
IPOExportRequest,
IPOExportRequestSet,
)
+from lp.translations.interfaces.pofile import IPOFile
from lp.translations.interfaces.potemplate import IPOTemplate
from lp.translations.interfaces.translationfileformat import (
TranslationFileFormat,
@@ -71,12 +72,23 @@ class POExportRequestSet:
)
potemplate_ids = ", ".join(
- [quote(template.id) for template in potemplates]
+ [
+ str(
+ template.id
+ if IPOTemplate.providedBy(template)
+ else template
+ )
+ for template in potemplates
+ ]
)
# A null pofile stands for the template itself. We represent it in
# SQL as -1, because that's how it's indexed in the request table.
pofile_ids = ", ".join(
- [quote(pofile.id) for pofile in pofiles] + ["-1"]
+ [
+ str(pofile.id if IPOFile.providedBy(pofile) else pofile)
+ for pofile in pofiles
+ ]
+ + ["-1"]
)
query_params = {