← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/recife-pre-cleanups into lp:~launchpad/launchpad/recife.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


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
-- 
https://code.launchpad.net/~jtv/launchpad/recife-pre-cleanups/+merge/40434
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/recife-pre-cleanups into lp:~launchpad/launchpad/recife.
=== modified file 'lib/lp/translations/interfaces/translationpolicy.py'
--- lib/lp/translations/interfaces/translationpolicy.py	2010-11-09 11:11:23 +0000
+++ lib/lp/translations/interfaces/translationpolicy.py	2010-11-09 14:36:04 +0000
@@ -9,12 +9,10 @@
     ]
 
 from zope.interface import Interface
-from zope.schema import (
-    Choice,
-    )
+from zope.schema import Choice
 
 from canonical.launchpad import _
-from lp.translations.interfaces.translationgroup import TranslationPermission
+from lp.translations.enums import TranslationPermission
 
 
 class ITranslationPolicy(Interface):

=== modified file 'lib/lp/translations/model/potemplate.py'
--- lib/lp/translations/model/potemplate.py	2010-11-09 06:44:07 +0000
+++ lib/lp/translations/model/potemplate.py	2010-11-09 14:36:04 +0000
@@ -368,6 +368,7 @@
 
     @property
     def translationtarget(self):
+        """See `IPOTemplate`."""
         if self.productseries is not None:
             return self.productseries
         elif self.distroseries is not None:

=== modified file 'lib/lp/translations/tests/test_translationpermission.py'
--- lib/lp/translations/tests/test_translationpermission.py	2010-11-08 10:02:51 +0000
+++ lib/lp/translations/tests/test_translationpermission.py	2010-11-09 14:36:04 +0000
@@ -13,23 +13,6 @@
 from lp.translations.interfaces.translator import ITranslatorSet
 
 
-# Description of the translations permissions model:
-# * OPEN lets anyone edit or suggest.
-# * STRUCTURED lets translation team members edit and anyone
-# suggest, but acts like OPEN when no translation team
-# applies.
-# * RESTRICTED lets translation team members edit and anyone
-# suggest, but acts like CLOSED when no translation team
-# applies.
-# * CLOSED lets only translation team members edit translations
-# or enter suggestions.
-translation_permissions = [
-    TranslationPermission.OPEN,
-    TranslationPermission.STRUCTURED,
-    TranslationPermission.RESTRICTED,
-    TranslationPermission.CLOSED,
-    ]
-
 # A user can be translating either a translation that's not covered by a
 # translation team ("untended"), or one that is ("tended"), or one whose
 # translation team the user is a member of ("member").
@@ -161,7 +144,7 @@
             permissions_model[permission, coverage],
             privilege_level,
             "Wrong privileges for %s with translation team coverage '%s'." % (
-                permission, coverage))
+                permission.name, coverage))
 
     def test_translationgroup_models(self):
         # Test that a translation group bestows the expected privilege
@@ -171,7 +154,7 @@
         user = self.factory.makePerson()
         product = self.factory.makeProduct()
         pofiles = self.makePOFilesForCoverageLevels(product, user)
-        for permission in translation_permissions:
+        for permission in TranslationPermission.items:
             product.translationpermission = permission
             for coverage in team_coverage:
                 pofile = pofiles[coverage]
@@ -185,7 +168,7 @@
         user = self.factory.makePerson()
         pofile = self.factory.makePOFile()
         product = pofile.potemplate.productseries.product
-        for permission in translation_permissions:
+        for permission in TranslationPermission.items:
             product.translationpermission = permission
             privilege_level = PrivilegeLevel.check(pofile, user)
             self.assertPrivilege(permission, 'untended', privilege_level)
@@ -234,9 +217,9 @@
         product = self.makeProductInProjectGroup()
         user = self.factory.makePerson()
         pofiles = self.makePOFilesForCoverageLevels(product, user)
-        for project_permission in translation_permissions:
+        for project_permission in TranslationPermission.items:
             product.project.translationpermission = project_permission
-            for product_permission in translation_permissions:
+            for product_permission in TranslationPermission.items:
                 product.translationpermission = product_permission
                 effective_permission = combine_permissions(product)
 
@@ -290,9 +273,9 @@
 
         # The strictest of Open and something else is always the
         # something else.
-        for project_permission in translation_permissions:
+        for project_permission in TranslationPermission.items:
             product.project.translationpermission = project_permission
-            for product_permission in translation_permissions:
+            for product_permission in TranslationPermission.items:
                 product.translationpermission = product_permission
                 expected_permission = (
                     combinations[project_permission][product_permission])

=== modified file 'lib/lp/translations/tests/test_translationpolicy.py'
--- lib/lp/translations/tests/test_translationpolicy.py	2010-11-08 02:29:37 +0000
+++ lib/lp/translations/tests/test_translationpolicy.py	2010-11-09 14:36:04 +0000
@@ -20,6 +20,7 @@
 
 
 class TranslationPolicyImplementation(TranslationPolicyMixin):
+    """An `ITranslationPolicy` implementation for testing."""
     implements(ITranslationPolicy)
 
     translationgroup = None
@@ -28,6 +29,10 @@
 
 
 class TestTranslationPolicy(TestCaseWithFactory):
+    """Test `TranslationPolicyMixin`.
+
+    :ivar policy: A `TranslationPolicyImplementation` for testing.
+    """
     layer = ZopelessDatabaseLayer
 
     def setUp(self):