Merge lp:~jtv/launchpad/recife-pre-cleanups into lp:~launchpad/launchpad/recife

Proposed by Jeroen T. Vermeulen on 2010-11-09
Status: Merged
Approved by: Graham Binns on 2010-11-09
Approved revision: no longer in the source branch.
Merged at revision: 9185
Proposed branch: lp:~jtv/launchpad/recife-pre-cleanups
Merge into: lp:~launchpad/launchpad/recife
Diff against target: 132 lines (+15/-28)
4 files modified
lib/lp/translations/interfaces/translationpolicy.py (+2/-4)
lib/lp/translations/model/potemplate.py (+1/-0)
lib/lp/translations/tests/test_translationpermission.py (+7/-24)
lib/lp/translations/tests/test_translationpolicy.py (+5/-0)
To merge this branch: bzr merge lp:~jtv/launchpad/recife-pre-cleanups
Reviewer Review Type Date Requested Status
Graham Binns (community) code 2010-11-09 Approve on 2010-11-09
Review via email: mp+40434@code.launchpad.net

Commit Message

Cleanups in preparation for policy work.

Description of the Change

I just completed a large sub-project for the Recife feature branch. I'm offloading some small incidental changes (docstring typo fixes, that sort of thing) into a smaller preparatory branch.

Which is what you're currently looking at.

No lint, no tests. This branch is basically cosmetic.

Jeroen

To post a comment you must log in.
Graham Binns (gmb) :
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/translations/interfaces/translationpolicy.py'
2--- lib/lp/translations/interfaces/translationpolicy.py 2010-11-09 11:11:23 +0000
3+++ lib/lp/translations/interfaces/translationpolicy.py 2010-11-09 14:36:49 +0000
4@@ -9,12 +9,10 @@
5 ]
6
7 from zope.interface import Interface
8-from zope.schema import (
9- Choice,
10- )
11+from zope.schema import Choice
12
13 from canonical.launchpad import _
14-from lp.translations.interfaces.translationgroup import TranslationPermission
15+from lp.translations.enums import TranslationPermission
16
17
18 class ITranslationPolicy(Interface):
19
20=== modified file 'lib/lp/translations/model/potemplate.py'
21--- lib/lp/translations/model/potemplate.py 2010-11-09 06:44:07 +0000
22+++ lib/lp/translations/model/potemplate.py 2010-11-09 14:36:49 +0000
23@@ -368,6 +368,7 @@
24
25 @property
26 def translationtarget(self):
27+ """See `IPOTemplate`."""
28 if self.productseries is not None:
29 return self.productseries
30 elif self.distroseries is not None:
31
32=== modified file 'lib/lp/translations/tests/test_translationpermission.py'
33--- lib/lp/translations/tests/test_translationpermission.py 2010-11-08 10:02:51 +0000
34+++ lib/lp/translations/tests/test_translationpermission.py 2010-11-09 14:36:49 +0000
35@@ -13,23 +13,6 @@
36 from lp.translations.interfaces.translator import ITranslatorSet
37
38
39-# Description of the translations permissions model:
40-# * OPEN lets anyone edit or suggest.
41-# * STRUCTURED lets translation team members edit and anyone
42-# suggest, but acts like OPEN when no translation team
43-# applies.
44-# * RESTRICTED lets translation team members edit and anyone
45-# suggest, but acts like CLOSED when no translation team
46-# applies.
47-# * CLOSED lets only translation team members edit translations
48-# or enter suggestions.
49-translation_permissions = [
50- TranslationPermission.OPEN,
51- TranslationPermission.STRUCTURED,
52- TranslationPermission.RESTRICTED,
53- TranslationPermission.CLOSED,
54- ]
55-
56 # A user can be translating either a translation that's not covered by a
57 # translation team ("untended"), or one that is ("tended"), or one whose
58 # translation team the user is a member of ("member").
59@@ -161,7 +144,7 @@
60 permissions_model[permission, coverage],
61 privilege_level,
62 "Wrong privileges for %s with translation team coverage '%s'." % (
63- permission, coverage))
64+ permission.name, coverage))
65
66 def test_translationgroup_models(self):
67 # Test that a translation group bestows the expected privilege
68@@ -171,7 +154,7 @@
69 user = self.factory.makePerson()
70 product = self.factory.makeProduct()
71 pofiles = self.makePOFilesForCoverageLevels(product, user)
72- for permission in translation_permissions:
73+ for permission in TranslationPermission.items:
74 product.translationpermission = permission
75 for coverage in team_coverage:
76 pofile = pofiles[coverage]
77@@ -185,7 +168,7 @@
78 user = self.factory.makePerson()
79 pofile = self.factory.makePOFile()
80 product = pofile.potemplate.productseries.product
81- for permission in translation_permissions:
82+ for permission in TranslationPermission.items:
83 product.translationpermission = permission
84 privilege_level = PrivilegeLevel.check(pofile, user)
85 self.assertPrivilege(permission, 'untended', privilege_level)
86@@ -234,9 +217,9 @@
87 product = self.makeProductInProjectGroup()
88 user = self.factory.makePerson()
89 pofiles = self.makePOFilesForCoverageLevels(product, user)
90- for project_permission in translation_permissions:
91+ for project_permission in TranslationPermission.items:
92 product.project.translationpermission = project_permission
93- for product_permission in translation_permissions:
94+ for product_permission in TranslationPermission.items:
95 product.translationpermission = product_permission
96 effective_permission = combine_permissions(product)
97
98@@ -290,9 +273,9 @@
99
100 # The strictest of Open and something else is always the
101 # something else.
102- for project_permission in translation_permissions:
103+ for project_permission in TranslationPermission.items:
104 product.project.translationpermission = project_permission
105- for product_permission in translation_permissions:
106+ for product_permission in TranslationPermission.items:
107 product.translationpermission = product_permission
108 expected_permission = (
109 combinations[project_permission][product_permission])
110
111=== modified file 'lib/lp/translations/tests/test_translationpolicy.py'
112--- lib/lp/translations/tests/test_translationpolicy.py 2010-11-08 02:29:37 +0000
113+++ lib/lp/translations/tests/test_translationpolicy.py 2010-11-09 14:36:49 +0000
114@@ -20,6 +20,7 @@
115
116
117 class TranslationPolicyImplementation(TranslationPolicyMixin):
118+ """An `ITranslationPolicy` implementation for testing."""
119 implements(ITranslationPolicy)
120
121 translationgroup = None
122@@ -28,6 +29,10 @@
123
124
125 class TestTranslationPolicy(TestCaseWithFactory):
126+ """Test `TranslationPolicyMixin`.
127+
128+ :ivar policy: A `TranslationPolicyImplementation` for testing.
129+ """
130 layer = ZopelessDatabaseLayer
131
132 def setUp(self):

Subscribers

People subscribed via source and target branches