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.
> === modified file 'lib/lp/registry/model/productseries.py'
> --- lib/lp/registry/model/productseries.py 2009-10-16 15:00:55 +0000
> +++ lib/lp/registry/model/productseries.py 2009-11-03 15:00:31 +0000
> @@ -526,10 +528,21 @@
> POTemplate.iscurrent==True,
> Language.id!=english.id).group_by(Language)
>
> - for (language, imported, changed, new, unreviewed) in (
> - query.order_by(['Language.englishname'])):
> + # XXX: Ursinha 2009-11-02: The Max(POFile.date_changed) result
> + # here is a naive datetime. My guess is that it happens
> + # because UTC awareness is attibuted to the field in the POFile
> + # model class, and in this case the Max function deals directly
> + # with the value returned from the database without
> + # instantiating it.
> + # 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'])):
This is a little hard to read. Maybe something like:
ordered_results = query.order_by(['Language.englishname'])
for (language, imported, changed, new, unreviewed, last_changed) in ordered_results:
...
Would be a little easier.
Also note that the indent on long loop definitions should still be four
spaces.
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.
> === modified file 'lib/lp/ registry/ model/productse ries.py' registry/ model/productse ries.py 2009-10-16 15:00:55 +0000 registry/ model/productse ries.py 2009-11-03 15:00:31 +0000 iscurrent= =True, id!=english. id).group_ by(Language) by(['Language. englishname' ])): date_changed) result by(['Language. englishname' ])):
> --- lib/lp/
> +++ lib/lp/
> @@ -526,10 +528,21 @@
> POTemplate.
> Language.
>
> - for (language, imported, changed, new, unreviewed) in (
> - query.order_
> + # XXX: Ursinha 2009-11-02: The Max(POFile.
> + # here is a naive datetime. My guess is that it happens
> + # because UTC awareness is attibuted to the field in the POFile
> + # model class, and in this case the Max function deals directly
> + # with the value returned from the database without
> + # instantiating it.
> + # 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_
This is a little hard to read. Maybe something like:
ordered_results = query.order_ by(['Language. englishname' ])
last_changed) in ordered_results:
for (language, imported, changed, new, unreviewed,
...
Would be a little easier.
Also note that the indent on long loop definitions should still be four
spaces.
> psl = ProductSeriesLa nguage( self, language) total, imported, changed, new, unreviewed) total, imported, changed, new, unreviewed,
> - psl.setCounts(
> + psl.setCounts(
> + last_changed)
When we wrap long method calls, we should wrap them like this:
psl.setCounts(
total, imported, changed, new, unreviewed, last_changed)
> results.append(psl) translations/ tests/test_ productseriesla nguage. py' translations/ tests/test_ productseriesla nguage. py 2009-09-12 16:07:05 +0000 translations/ tests/test_ productseriesla nguage. py 2009-11-03 15:00:31 +0000 ILanguageSet) .getLanguageByC ode('sr' ) makePOFile( serbian. code, potemplate) productseries. productseriesla nguages) ls(len( psls), 1) roxy(potemplate ).messagecount = number_ of_potmsgsets tics(self, pofile, imported, changed, new, unreviewed): tics(self, pofile, imported, changed, new, unreviewed,
>
> return results
>
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -46,6 +46,7 @@
> # Add a Serbian translation.
> serbian = getUtility(
> sr_pofile = self.factory.
> +
> psls = list(self.
> self.assertEqua
>
> @@ -111,7 +112,8 @@
> removeSecurityP
> return potemplate
>
> - def setPOFileStatis
> + def setPOFileStatis
> + date_changed):
The wrapped lines of a method definition should start under the first
argument, thus:
def setPOFileStatis tics(self, pofile, imported, changed, new, unreviewed,
date_changed) :
> # Instead of creating all relevant translation messages, we roxy(pofile) ount()) , ount(), changed_ date), ctSeriesLanguag e(self) : set.getDummy( self.productser ies, self.language) (verifyObject( IProductSeriesL anguage, psl)) tatistics( psl, (0, 0, 0, 0, 0, 0)) tatistics( psl, (0, 0, 0, 0, 0, 0, None)) mplateWithPOTMs gSets(10) set.getDummy( self.productser ies, self.language) tatistics( psl, (10, 0, 0, 0, 0, 0)) tatistics( psl, (10, 0, 0, 0, 0, 0,
> # just fake cached statistics instead.
> naked_pofile = removeSecurityP
> @@ -136,20 +139,22 @@
> psl.currentCount(),
> psl.rosettaCount(),
> psl.updatesCount(),
> - psl.unreviewedC
> + psl.unreviewedC
> + psl.last_
> stats)
>
> def test_DummyProdu
> # With no templates all counts are zero.
> psl = self.psl_
> self.failUnless
> - self.assertPSLS
> + self.assertPSLS
>
> # Adding a single template with 10 messages makes the total
> # count of messages go up to 10.
> potemplate = self.createPOTe
> psl = self.psl_
> - self.assertPSLS
> + self.assertPSLS
> + None))
Again, this should be wrapped as:
psl, (10, 0, 0, 0, 0, 0, None))
> e(self) :
> def test_OneTemplat
> # With only one template, statistics match those of the POFile.