Code review comment for lp:~ursinha/launchpad/bug-391569-add-last-changed-column

Revision history for this message
Ursula Junque (ursinha) wrote :

> Hi Ursula,
>
> Nice branch! I've got a few comments but they're all stylistic nitpicks, so
> I'm happy to approve this with the changes I've requested.

All changes applied, incremental diff below. Thanks!

=== modified file 'lib/lp/registry/model/productseries.py'
--- lib/lp/registry/model/productseries.py 2009-11-03 04:55:45 +0000
+++ lib/lp/registry/model/productseries.py 2009-11-04 17:15:56 +0000
@@ -493,13 +493,15 @@
                 POTemplate.iscurrent==True,
                 Language.id!=english.id)

- for language, pofile in query.order_by(['Language.englishname']):
+ ordered_results = query.order_by(['Language.englishname'])
+
+ for language, pofile in ordered_results:
                 psl = ProductSeriesLanguage(self, language, pofile=pofile)
                 psl.setCounts(pofile.potemplate.messageCount(),
                               pofile.currentCount(),
                               pofile.updatesCount(),
                               pofile.rosettaCount(),
- pofile.unreviewedCount(),
+ pofile.unreviewedCount(),
                               pofile.date_changed)
                 results.append(psl)
         else:
@@ -537,12 +539,13 @@
             # This seems to be irrelevant to what we're trying to achieve
             # here, but making a note either way.

- for (language, imported, changed, new, unreviewed,
- last_changed) in (
- query.order_by(['Language.englishname'])):
+ ordered_results = query.order_by(['Language.englishname'])
+
+ for (language, imported, changed, new, unreviewed,
+ last_changed) in ordered_results:
                 psl = ProductSeriesLanguage(self, language)
- psl.setCounts(total, imported, changed, new, unreviewed,
- last_changed)
+ psl.setCounts(
+ total, imported, changed, new, unreviewed, last_changed)
                 results.append(psl)

         return results

=== modified file 'lib/lp/translations/tests/test_productserieslanguage.py'
--- lib/lp/translations/tests/test_productserieslanguage.py 2009-11-03 13:53:07 +0000
+++ lib/lp/translations/tests/test_productserieslanguage.py 2009-11-04 17:15:56 +0000
@@ -113,7 +113,7 @@
         return potemplate

     def setPOFileStatistics(self, pofile, imported, changed, new, unreviewed,
- date_changed):
+ date_changed):
         # Instead of creating all relevant translation messages, we
         # just fake cached statistics instead.
         naked_pofile = removeSecurityProxy(pofile)
@@ -141,7 +141,7 @@
              psl.updatesCount(),
              psl.unreviewedCount(),
              psl.last_changed_date),
- stats)
+ stats)

     def test_DummyProductSeriesLanguage(self):
         # With no templates all counts are zero.
@@ -153,8 +153,8 @@
         # count of messages go up to 10.
         potemplate = self.createPOTemplateWithPOTMsgSets(10)
         psl = self.psl_set.getDummy(self.productseries, self.language)
- self.assertPSLStatistics(psl, (10, 0, 0, 0, 0, 0,
- None))
+ self.assertPSLStatistics(
+ psl, (10, 0, 0, 0, 0, 0, None))

     def test_OneTemplate(self):
         # With only one template, statistics match those of the POFile.

« Back to merge proposal