← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/launchpad/enum-translationpermission into lp:launchpad/devel

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/enum-translationpermission into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers): code


= Moving TranslationPermission into enums =

We just added an enums.py to Translations.  This branch moves one of our enums in there, hopefully reducing the pressure towards circular imports a bit.

The only way to be sure that I got it all right is to run all tests, which should be just what EC2 is doing for me right now.


Jeroen
-- 
https://code.launchpad.net/~jtv/launchpad/enum-translationpermission/+merge/40192
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/enum-translationpermission into lp:launchpad/devel.
=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py	2010-11-02 20:10:56 +0000
+++ lib/lp/registry/model/distribution.py	2010-11-05 15:18:48 +0000
@@ -188,7 +188,7 @@
     SourcePackagePublishingHistory,
     )
 from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
-from lp.translations.interfaces.translationgroup import TranslationPermission
+from lp.translations.enums import TranslationPermission
 from lp.translations.model.hastranslationimports import (
     HasTranslationImportsMixin,
     )

=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py	2010-11-02 20:10:56 +0000
+++ lib/lp/registry/model/product.py	2010-11-05 15:18:48 +0000
@@ -161,10 +161,10 @@
     cachedproperty,
     get_property_cache,
     )
+from lp.translations.enums import TranslationPermission
 from lp.translations.interfaces.customlanguagecode import (
     IHasCustomLanguageCodes,
     )
-from lp.translations.interfaces.translationgroup import TranslationPermission
 from lp.translations.model.customlanguagecode import (
     CustomLanguageCode,
     HasCustomLanguageCodesMixin,

=== modified file 'lib/lp/registry/model/projectgroup.py'
--- lib/lp/registry/model/projectgroup.py	2010-11-02 20:10:56 +0000
+++ lib/lp/registry/model/projectgroup.py	2010-11-05 15:18:48 +0000
@@ -104,7 +104,7 @@
     StructuralSubscriptionTargetMixin,
     )
 from lp.services.worlddata.model.language import Language
-from lp.translations.interfaces.translationgroup import TranslationPermission
+from lp.translations.enums import TranslationPermission
 
 
 class ProjectGroup(SQLBase, BugTargetBase, HasSpecificationsMixin,
@@ -175,7 +175,7 @@
     def getConfigurableProducts(self):
         return [product for product in self.products
                 if check_permission('launchpad.Edit', product)]
-                    
+
     @property
     def drivers(self):
         """See `IHasDrivers`."""

=== modified file 'lib/lp/translations/browser/serieslanguage.py'
--- lib/lp/translations/browser/serieslanguage.py	2010-09-27 16:49:22 +0000
+++ lib/lp/translations/browser/serieslanguage.py	2010-11-05 15:18:48 +0000
@@ -18,13 +18,13 @@
 from canonical.launchpad.webapp.publisher import Navigation
 from lp.app.browser.tales import PersonFormatterAPI
 from lp.services.propertycache import cachedproperty
+from lp.translations.enums import TranslationPermission
 from lp.translations.interfaces.distroserieslanguage import (
     IDistroSeriesLanguage,
     )
 from lp.translations.interfaces.productserieslanguage import (
     IProductSeriesLanguage,
     )
-from lp.translations.interfaces.translationgroup import TranslationPermission
 from lp.translations.interfaces.translationsperson import ITranslationsPerson
 
 

=== modified file 'lib/lp/translations/browser/tests/translationmessage-views.txt'
--- lib/lp/translations/browser/tests/translationmessage-views.txt	2010-10-27 20:53:18 +0000
+++ lib/lp/translations/browser/tests/translationmessage-views.txt	2010-11-05 15:18:48 +0000
@@ -684,8 +684,7 @@
 
 We need to force timestamp update, since suggestions are submitted too fast.
 
-    >>> from lp.translations.interfaces.translationgroup import (
-    ...     TranslationPermission)
+    >>> from lp.translations.enums import TranslationPermission
     >>> pofile = factory.makePOFile('es')
     >>> potemplate = pofile.potemplate
     >>> potmsgset = factory.makePOTMsgSet(potemplate, sequence=1)

=== modified file 'lib/lp/translations/doc/pofile.txt'
--- lib/lp/translations/doc/pofile.txt	2010-10-18 22:24:59 +0000
+++ lib/lp/translations/doc/pofile.txt	2010-11-05 15:18:48 +0000
@@ -393,8 +393,9 @@
     >>> from canonical.launchpad.interfaces.launchpad import (
     ...     ILaunchpadCelebrities)
     >>> from lp.registry.interfaces.product import IProductSet
+    >>> from lp.translations.enums import TranslationPermission
     >>> from lp.translations.interfaces.translationgroup import (
-    ...     ITranslationGroupSet, TranslationPermission)
+    ...     ITranslationGroupSet)
     >>> from canonical.launchpad.ftests import login
     >>> from lp.translations.model.pofile import POFile
     >>> person_set = getUtility(IPersonSet)

=== modified file 'lib/lp/translations/doc/rosetta-poimport-script.txt'
--- lib/lp/translations/doc/rosetta-poimport-script.txt	2010-10-29 05:58:51 +0000
+++ lib/lp/translations/doc/rosetta-poimport-script.txt	2010-11-05 15:18:48 +0000
@@ -57,8 +57,7 @@
 enough (but we could go with "open" as well, which would allow not
 only suggestions but full translations as well).
 
-    >>> from lp.translations.interfaces.translationgroup import (
-    ...     TranslationPermission)
+    >>> from lp.translations.enums import TranslationPermission
     >>> product = pofile.potemplate.productseries.product
     >>> product.translationpermission = TranslationPermission.STRUCTURED
 

=== modified file 'lib/lp/translations/doc/translationgroup.txt'
--- lib/lp/translations/doc/translationgroup.txt	2010-10-03 15:30:06 +0000
+++ lib/lp/translations/doc/translationgroup.txt	2010-11-05 15:18:48 +0000
@@ -58,8 +58,7 @@
 
 Let's only allow translators from that group to translate.
 
-    >>> from lp.translations.interfaces.translationgroup import (
-    ...     TranslationPermission)
+    >>> from lp.translations.enums import TranslationPermission
     >>> evolution.translationpermission = TranslationPermission.CLOSED
 
 No Privileges Person isn't allowed to translate into Welsh.

=== modified file 'lib/lp/translations/doc/translationmessage.txt'
--- lib/lp/translations/doc/translationmessage.txt	2010-10-28 03:55:41 +0000
+++ lib/lp/translations/doc/translationmessage.txt	2010-11-05 15:18:48 +0000
@@ -112,8 +112,7 @@
     >>> product = productseries.product
     >>> product.translationgroup = factory.makeTranslationGroup(product.owner)
 
-    >>> from lp.translations.interfaces.translationgroup import (
-    ...     TranslationPermission)
+    >>> from lp.translations.enums import TranslationPermission
     >>> product.translationpermission = TranslationPermission.STRUCTURED
 
 The only Serbian reviewer in this translation group is 'name16' user.

=== modified file 'lib/lp/translations/enums.py'
--- lib/lp/translations/enums.py	2010-10-29 05:58:51 +0000
+++ lib/lp/translations/enums.py	2010-11-05 15:18:48 +0000
@@ -6,6 +6,7 @@
 __metaclass__ = type
 __all__ = [
     'RosettaImportStatus',
+    'TranslationPermission',
     ]
 
 from lazr.enum import (
@@ -65,3 +66,52 @@
 
         The reviewer needs more information before this entry can be approved.
         """)
+
+
+class TranslationPermission(DBEnumeratedType):
+    """Translation Permission System
+
+    Projects groups, products and distributions can all have content that
+    needs to be translated. In this case, Launchpad Translations allows them
+    to decide how open they want that translation process to be. At one
+    extreme, anybody can add or edit any translation, without review. At the
+    other, only the designated translator for that group in that language can
+    add or edit its translation files. This schema enumerates the options.
+    """
+
+    OPEN = DBItem(1, """
+        Open
+
+        This group allows totally open access to its translations. Any
+        logged-in user can add or edit translations in any language, without
+        any review.""")
+
+    STRUCTURED = DBItem(20, """
+        Structured
+
+        This group has designated translators for certain languages. In
+        those languages, people who are not designated translators can only
+        make suggestions. However, in languages which do not yet have a
+        designated translator, anybody can edit the translations directly,
+        with no further review.""")
+
+    RESTRICTED = DBItem(100, """
+        Restricted
+
+        This group allows only designated translators to edit the
+        translations of its files. You can become a designated translator
+        either by joining an existing language translation team for this
+        project, or by getting permission to start a new team for a new
+        language. People who are not designated translators can still make
+        suggestions for new translations, but those suggestions need to be
+        reviewed before being accepted by the designated translator.""")
+
+    CLOSED = DBItem(200, """
+        Closed
+
+        This group allows only designated translators to edit or add
+        translations. You can become a designated translator either by
+        joining an existing language translation team for this
+        project, or by getting permission to start a new team for a new
+        language. People who are not designated translators will not be able
+        to add suggestions.""")

=== modified file 'lib/lp/translations/interfaces/pofile.py'
--- lib/lp/translations/interfaces/pofile.py	2010-09-01 16:04:16 +0000
+++ lib/lp/translations/interfaces/pofile.py	2010-11-05 15:18:48 +0000
@@ -42,9 +42,9 @@
 from canonical.launchpad import _
 from canonical.launchpad.webapp.interfaces import ILaunchBag
 from lp.registry.interfaces.person import IPerson
+from lp.translations.enums import TranslationPermission
 from lp.translations.interfaces.potemplate import IPOTemplate
 from lp.translations.interfaces.rosettastats import IRosettaStats
-from lp.translations.interfaces.translationgroup import TranslationPermission
 from lp.translations.interfaces.translationsperson import ITranslationsPerson
 
 

=== modified file 'lib/lp/translations/interfaces/translationgroup.py'
--- lib/lp/translations/interfaces/translationgroup.py	2010-09-03 06:37:26 +0000
+++ lib/lp/translations/interfaces/translationgroup.py	2010-11-05 15:18:48 +0000
@@ -14,10 +14,6 @@
     'TranslationPermission',
     ]
 
-from lazr.enum import (
-    DBEnumeratedType,
-    DBItem,
-    )
 from zope.interface import (
     Attribute,
     Interface,
@@ -38,55 +34,7 @@
     Title,
     URIField,
     )
-
-
-class TranslationPermission(DBEnumeratedType):
-    """Translation Permission System
-
-    Projects groups, products and distributions can all have content that
-    needs to be translated. In this case, Launchpad Translations allows them
-    to decide how open they want that translation process to be. At one
-    extreme, anybody can add or edit any translation, without review. At the
-    other, only the designated translator for that group in that language can
-    add or edit its translation files. This schema enumerates the options.
-    """
-
-    OPEN = DBItem(1, """
-        Open
-
-        This group allows totally open access to its translations. Any
-        logged-in user can add or edit translations in any language, without
-        any review.""")
-
-    STRUCTURED = DBItem(20, """
-        Structured
-
-        This group has designated translators for certain languages. In
-        those languages, people who are not designated translators can only
-        make suggestions. However, in languages which do not yet have a
-        designated translator, anybody can edit the translations directly,
-        with no further review.""")
-
-    RESTRICTED = DBItem(100, """
-        Restricted
-
-        This group allows only designated translators to edit the
-        translations of its files. You can become a designated translator
-        either by joining an existing language translation team for this
-        project, or by getting permission to start a new team for a new
-        language. People who are not designated translators can still make
-        suggestions for new translations, but those suggestions need to be
-        reviewed before being accepted by the designated translator.""")
-
-    CLOSED = DBItem(200, """
-        Closed
-
-        This group allows only designated translators to edit or add
-        translations. You can become a designated translator either by
-        joining an existing language translation team for this
-        project, or by getting permission to start a new team for a new
-        language. People who are not designated translators will not be able
-        to add suggestions.""")
+from lp.translations.enums import TranslationPermission
 
 
 class ITranslationPolicy(Interface):

=== modified file 'lib/lp/translations/model/pofile.py'
--- lib/lp/translations/model/pofile.py	2010-10-29 10:17:14 +0000
+++ lib/lp/translations/model/pofile.py	2010-11-05 15:18:48 +0000
@@ -70,7 +70,10 @@
 from lp.registry.interfaces.person import validate_public_person
 from lp.registry.model.person import Person
 from lp.services.propertycache import cachedproperty
-from lp.translations.enums import RosettaImportStatus
+from lp.translations.enums import (
+    RosettaImportStatus,
+    TranslationPermission,
+    )
 from lp.translations.interfaces.pofile import (
     IPOFile,
     IPOFileSet,
@@ -85,7 +88,6 @@
 from lp.translations.interfaces.translationexporter import (
     ITranslationExporter,
     )
-from lp.translations.interfaces.translationgroup import TranslationPermission
 from lp.translations.interfaces.translationimporter import (
     ITranslationImporter,
     NotExportedFromLaunchpad,

=== modified file 'lib/lp/translations/model/translationsperson.py'
--- lib/lp/translations/model/translationsperson.py	2010-08-31 23:03:45 +0000
+++ lib/lp/translations/model/translationsperson.py	2010-11-05 15:18:48 +0000
@@ -32,10 +32,8 @@
 from lp.registry.model.projectgroup import ProjectGroup
 from lp.registry.model.teammembership import TeamParticipation
 from lp.services.worlddata.model.language import Language
-from lp.translations.interfaces.translationgroup import (
-    ITranslationGroupSet,
-    TranslationPermission,
-    )
+from lp.translations.enums import TranslationPermission
+from lp.translations.interfaces.translationgroup import ITranslationGroupSet
 from lp.translations.interfaces.translationsperson import ITranslationsPerson
 from lp.translations.interfaces.translator import ITranslatorSet
 from lp.translations.model.pofile import POFile

=== modified file 'lib/lp/translations/stories/standalone/xx-serieslanguage-index.txt'
--- lib/lp/translations/stories/standalone/xx-serieslanguage-index.txt	2010-10-03 15:30:06 +0000
+++ lib/lp/translations/stories/standalone/xx-serieslanguage-index.txt	2010-11-05 15:18:48 +0000
@@ -54,8 +54,7 @@
     >>> from zope.component import getUtility
     >>> from canonical.launchpad.interfaces.launchpad import (
     ...     ILaunchpadCelebrities)
-    >>> from lp.translations.interfaces.translationgroup import (
-    ...     TranslationPermission)
+    >>> from lp.translations.enums import TranslationPermission
     >>> login('foo.bar@xxxxxxxxxxxxx')
     >>> utc_owner = factory.makePerson(displayname='Some Guy')
     >>> utc_team = factory.makeTeam(

=== modified file 'lib/lp/translations/stories/standalone/xx-translation-access-display.txt'
--- lib/lp/translations/stories/standalone/xx-translation-access-display.txt	2010-10-18 22:24:59 +0000
+++ lib/lp/translations/stories/standalone/xx-translation-access-display.txt	2010-11-05 15:18:48 +0000
@@ -126,8 +126,7 @@
 If Evolution's translation is set to Closed mode, Joe will not be able
 to submit suggestions.
 
-    >>> from lp.translations.interfaces.translationgroup import (
-    ...     TranslationPermission)
+    >>> from lp.translations.enums import TranslationPermission
     >>> evolution.translationpermission = TranslationPermission.CLOSED
     >>> user_browser.open(
     ...     'http://translations.launchpad.dev/'

=== modified file 'lib/lp/translations/utilities/tests/test_file_importer.py'
--- lib/lp/translations/utilities/tests/test_file_importer.py	2010-10-04 20:46:55 +0000
+++ lib/lp/translations/utilities/tests/test_file_importer.py	2010-11-05 15:18:48 +0000
@@ -12,7 +12,7 @@
 from canonical.testing.layers import ZopelessDatabaseLayer
 from lp.registry.interfaces.person import IPersonSet
 from lp.testing import TestCaseWithFactory
-from lp.translations.interfaces.translationgroup import TranslationPermission
+from lp.translations.enums import TranslationPermission
 from lp.translations.interfaces.translationimporter import (
     OutdatedTranslationError,
     )