Code review comment for lp:~adiroiban/launchpad/bug-525371

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

We've been discussing this in IRC. It turns out that IDistroSeries.getTranslationTemplates wasn't batching properly because it used shortlist() to limit its results. As a side effect, that listifies the query result—causing all its results to be fetched and marshaled. The batching logic then slices the resulting list instead of the query result, which is somewhat pointless.

The docstring deliberately makes no promise that getTranslationTemplates returns a list, so it's perfectly valid to return the query result directly instead of a shortlisted version of it. Unfortunately the distroseries translations copying script does assert that len(child.getTranslationTemplates()) == 0. This assumes a list-like return value; with a query it should assert that child.getTranslationTemplates.is_empty().

« Back to merge proposal