Merge lp:~henninge/launchpad/bug-523810-needs-information-age into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Henning Eggers on 2010-02-19 | ||||
| Approved revision: | not available | ||||
| Merged at revision: | not available | ||||
| Proposed branch: | lp:~henninge/launchpad/bug-523810-needs-information-age | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
548 lines (+122/-89) 3 files modified
lib/lp/translations/interfaces/translationimportqueue.py (+19/-0) lib/lp/translations/model/translationimportqueue.py (+3/-15) lib/lp/translations/tests/test_autoapproval.py (+100/-74) |
||||
| To merge this branch: | bzr merge lp:~henninge/launchpad/bug-523810-needs-information-age | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Abel Deuring (community) | code | 2010-02-19 | Approve on 2010-02-19 |
|
Review via email:
|
|||
Commit Message
Added a maximum age for translation import queue entries in the new 'Needs Information' state.
| Henning Eggers (henninge) wrote : | # |
| Abel Deuring (adeuring) wrote : | # |
Hi Henning,
overall a nice branc, but I have a couple of questions, see
below.
Abel
> = Bug 523810 =
>
> The import queue gardener removes entries from the import
> queue that have reached a certain age in certain states.
> The age is configurable through a look-up table and the new
> "Needs Information" status needs an entry in that table.
> The maximum age should be identical to "Needs Review" for
> starters.
>
> == Implementation details ==
>
> Driven by the want to extend test coverage to all entry
> states that are being cleaned out I moved the look-up
> table to the interface module where it can be reached
> from the test.
>
> I also found a nice little use of the with statement again. ;-)
>
> == Tests ==
>
> Run all autoapproval test to verify that the introduction of
> the GardenerDbUserMixin did not mess up existing tests.
>
> bin/test -vvt autoapproval
>
> == Demo/QA ==
>
> In order to not have to wait half a year for an entry to
> expire on staging, some SQL magic will be needed to make an
> entry in the "Needs Information" stage that old. Then wait
> for a day or so to see it disappear. Staging updates might
> be a nuissance here.
>
> = Launchpad lint =
>
> Checking for conflicts. and issues in doctests and templates.
> Running jslint, xmllint, pyflakes, and pylint.
> Using normal rules.
>
> Linting changed files:
> lib/lp/
> lib/lp/
> lib/lp/
>
>
> == Pylint notices ==
>
> lib/lp/
> 12: [F0401] Unable to import 'lazr.enum' (No module named enum)
> 22: [F0401] Unable to import 'lazr.restful.
> 23: [F0401] Unable to import 'lazr.restful.
> 24: [F0401] Unable to import 'lazr.restful.
>
>
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -3,6 +3,8 @@
>
> # pylint: disable-
>
> +from datetime import timedelta
> +
> from zope.interface import Interface, Attribute
> from zope.schema import (
> Bool, Choice, Datetime, Field, Int, Object, Text, TextLine)
> @@ -39,6 +41,7 @@
> 'RosettaImportS
> 'SpecialTransla
> 'TranslationFil
> + 'TranslationImp
> 'UserCannotSetT
> ]
>
> @@ -111,6 +114,22 @@
> """)
>
>
> +# Some time spans in days.
> +_month = 30
> +_half_year = 366 / 2
This being constants, they should be defined as MONTH and HALF_YEAR,
I think, but...
> +
> +
> +# Period after which entries with certain statuses are culled from the
> +# queue.
> +TranslationImp
> + RosettaImportSt
> + RosettaImportSt
...seeing this, I think the constants are probably better called
DAYS_OF_
| Henning Eggers (henninge) wrote : | # |
> Hi Henning,
Hallo Abel!
> overall a nice branc, but I have a couple of questions, see
> below.
Thanks for the review, though. ;)
> > === modified file
'lib/lp/
> > --- lib/lp/
> 10:39:45 +0000
> > +++ lib/lp/
> 09:03:16 +0000
> > @@ -3,6 +3,8 @@
> >
> > # pylint: disable-
> >
> > +from datetime import timedelta
> > +
> > from zope.interface import Interface, Attribute
> > from zope.schema import (
> > Bool, Choice, Datetime, Field, Int, Object, Text, TextLine)
> > @@ -39,6 +41,7 @@
> > 'RosettaImportS
> > 'SpecialTransla
> > 'TranslationFil
> > + 'TranslationImp
> > 'UserCannotSetT
> > ]
> >
> > @@ -111,6 +114,22 @@
> > """)
> >
> >
> > +# Some time spans in days.
> > +_month = 30
> > +_half_year = 366 / 2
>
> This being constants, they should be defined as MONTH and HALF_YEAR,
> I think, but...
>
> > +
> > +
> > +# Period after which entries with certain statuses are culled from the
> > +# queue.
> > +TranslationImp
> > + RosettaImportSt
> > + RosettaImportSt
>
> ...seeing this, I think the constants are probably better called
> DAYS_OF_
Yes, you are right about the capitalization. And the names are good
suggestions, too. Fixed that.
>
> > + RosettaImportSt
> > + RosettaImportSt
> > + RosettaImportSt
> > +}
>
> Our coding style convetions say that this should called
> translation_
> need to define it in the interfaces module, you could also
> add it to the __all__ list of the model module.
I renamed it but left it in place here, as per our discussion on IRC. We
agreed that the general rule is that tests should not import from model
code. I also noted that I consider these expiration times as
implementation-
have this here in the interface module. You agreed to the latter.
>
> > +
> > +
> > class SpecialTranslat
> > """Special "meta-targets" to filter the queue view by."""
> >
> >
> > === modified file 'lib/lp/
[...]
> > === modified file 'lib/lp/
> > --- lib/lp/
15:25:53
> +0000
> > +++ lib/lp/
09:03:16
> +0000
> > @@ -8,6 +8,9 @@
> > through the possibilities should go here.
> > """
> >
> > +from __future__ import with_statement
> > +
> > +from contextlib import contextmanager
> > from datetime import datetime, timedelta
> > from pytz import UTC
> > import transaction
> > @@ -31,17 +34,28 @@
>...

= Bug 523810 =
The import queue gardener removes entries from the import queue that have reached a certain age in certain states. The age is configurable through a look-up table and the new "Needs Information" status needs an entry in that table. The maximum age should be identical to "Needs Review" for starters.
== Implementation details ==
Driven by the want to extend test coverage to all entry states that are being cleaned out I moved the look-up table to the interface module where it can be reached from the test.
I also found a nice little use of the with statement again. ;-)
== Tests ==
Run all autoapproval test to verify that the introduction of the GardenerDbUserMixin did not mess up existing tests.
bin/test -vvt autoapproval
== Demo/QA ==
In order to not have to wait half a year for an entry to expire on staging, some SQL magic will be needed to make an entry in the "Needs Information" stage that old. Then wait for a day or so to see it disappear. Staging updates might be a nuissance here.
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: translations/ interfaces/ translationimpo rtqueue. py translations/ model/translati onimportqueue. py translations/ tests/test_ autoapproval. py
lib/lp/
lib/lp/
lib/lp/
== Pylint notices ==
lib/lp/ translations/ interfaces/ translationimpo rtqueue. py interface' (No module named restful) fields' (No module named restful) declarations' (No module named restful)
12: [F0401] Unable to import 'lazr.enum' (No module named enum)
22: [F0401] Unable to import 'lazr.restful.
23: [F0401] Unable to import 'lazr.restful.
24: [F0401] Unable to import 'lazr.restful.