Merge lp:~jtv/launchpad/bug-503769 into lp:launchpad

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~jtv/launchpad/bug-503769
Merge into: lp:launchpad
Diff against target: 59 lines (+10/-3)
3 files modified
lib/lp/registry/model/product.py (+3/-1)
lib/lp/translations/scripts/po_import.py (+3/-1)
lib/lp/translations/scripts/translations_to_branch.py (+4/-1)
To merge this branch: bzr merge lp:~jtv/launchpad/bug-503769
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+16966@code.launchpad.net

Commit message

Fix Translations import policy violations.

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

= Bug 503769 =

When running ./bin/test, even with a pattern that matches zero tests, we now get a long list of import policy violations throughout the codebase. A few are related to Translations code; this branch fixes those.

No lint. To test, try
{{{
./bin/test -vv -t a-test-that-does-not-exist
}}}

This will still warn about policy violations, but several will be gone:
{{{
You should not import ITranslationImportQueue from lp.translations.model.translationimportqueue:
    lp.registry.model.product
You should not import UTC from pytz:
    lp.translations.scripts.po_import
    lp.translations.scripts.translations_to_branch
}}}

(Look for these very near the end of the list of warnings).

Jeroen

Revision history for this message
Abel Deuring (adeuring) wrote :

Thanks for fixing this!

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/model/product.py'
2--- lib/lp/registry/model/product.py 2009-12-05 18:37:28 +0000
3+++ lib/lp/registry/model/product.py 2010-01-07 13:58:19 +0000
4@@ -69,8 +69,10 @@
5 from lp.blueprints.model.specification import (
6 HasSpecificationsMixin, Specification)
7 from lp.blueprints.model.sprint import HasSprintsMixin
8+from lp.translations.interfaces.translationimportqueue import (
9+ ITranslationImportQueue)
10 from lp.translations.model.translationimportqueue import (
11- HasTranslationImportsMixin, ITranslationImportQueue)
12+ HasTranslationImportsMixin)
13 from lp.registry.model.structuralsubscription import (
14 StructuralSubscriptionTargetMixin)
15 from canonical.launchpad.helpers import shortlist
16
17=== modified file 'lib/lp/translations/scripts/po_import.py'
18--- lib/lp/translations/scripts/po_import.py 2010-01-05 16:07:31 +0000
19+++ lib/lp/translations/scripts/po_import.py 2010-01-07 13:58:19 +0000
20@@ -13,7 +13,7 @@
21 from datetime import datetime, timedelta
22 import sys
23
24-from pytz import UTC
25+from pytz import timezone
26 from zope.component import getUtility
27
28 from canonical.config import config
29@@ -143,6 +143,8 @@
30 """Import entries from the queue."""
31 self.logger.debug("Starting the import process.")
32
33+ UTC = timezone('UTC')
34+
35 self.deadline = datetime.now(UTC) + self.time_to_run
36 translation_import_queue = getUtility(ITranslationImportQueue)
37
38
39=== modified file 'lib/lp/translations/scripts/translations_to_branch.py'
40--- lib/lp/translations/scripts/translations_to_branch.py 2009-11-18 14:39:48 +0000
41+++ lib/lp/translations/scripts/translations_to_branch.py 2010-01-07 13:58:19 +0000
42@@ -9,7 +9,7 @@
43
44 import os.path
45 from datetime import datetime, timedelta
46-from pytz import UTC
47+from pytz import timezone
48
49 from zope.component import getUtility
50
51@@ -27,6 +27,9 @@
52 from lp.services.scripts.base import LaunchpadCronScript
53
54
55+UTC = timezone('UTC')
56+
57+
58 class ExportTranslationsToBranch(LaunchpadCronScript):
59 """Commit translations to translations_branches where requested."""
60