← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/launchpad/bug-668194-split-interfaces into lp:launchpad/devel

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/bug-668194-split-interfaces into lp:launchpad/devel.

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


= Bug 668194: Split Interfaces =

This is a preparatory branch for the coming fix to bug 668194.  It's an oversized diff, but actually nothing particularly difficult happens.

In a nutshell: Distribution, DistroSeries, Person, Product, and ProductSeries implement IHasTranslationImports.  But we'll have to rearrange this for web-service API purposes.  IDistribution, IDistroSeries etc. need to derive from IHasTranslationImports.

Doing that immediately would trigger lots of circular-import problems.  So instead I start with this preparation, which consists of just 2 things:

1. Move RosettaImportStatus out of lp.translations.interfaces.translationimportqueue into a new lp.translations.enums module like the other apps already have.

2. Move IHasTranslationImports out of lp.translations.interfaces.translationimportqueue into a new module of its own: lp.translations.interfaces.hastranslationimports.

It's hard to say what tests this could possibly affect, so I'm running them all.  There is plenty of lint left, but a branch this size is not a good place to fix it.


Jeroen
-- 
https://code.launchpad.net/~jtv/launchpad/bug-668194-split-interfaces/+merge/39600
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/bug-668194-split-interfaces into lp:launchpad/devel.
=== modified file 'lib/canonical/launchpad/interfaces/_schema_circular_imports.py'
--- lib/canonical/launchpad/interfaces/_schema_circular_imports.py	2010-10-21 12:50:05 +0000
+++ lib/canonical/launchpad/interfaces/_schema_circular_imports.py	2010-10-29 07:12:51 +0000
@@ -114,6 +114,9 @@
     )
 from lp.soyuz.interfaces.queue import IPackageUpload
 from lp.soyuz.interfaces.sourcepackagerelease import ISourcePackageRelease
+from lp.translations.interfaces.hastranslationimports import (
+    IHasTranslationImports,
+    )
 from lp.translations.interfaces.pofile import IPOFile
 from lp.translations.interfaces.potemplate import (
     IPOTemplate,
@@ -121,7 +124,6 @@
     IPOTemplateSubset,
     )
 from lp.translations.interfaces.translationimportqueue import (
-    IHasTranslationImports,
     ITranslationImportQueueEntry,
     )
 

=== modified file 'lib/lp/code/model/tests/test_branchjob.py'
--- lib/lp/code/model/tests/test_branchjob.py	2010-10-26 15:47:24 +0000
+++ lib/lp/code/model/tests/test_branchjob.py	2010-10-29 07:12:51 +0000
@@ -80,9 +80,9 @@
 from lp.services.osutils import override_environ
 from lp.testing import TestCaseWithFactory
 from lp.testing.mail_helpers import pop_notifications
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.translationimportqueue import (
     ITranslationImportQueue,
-    RosettaImportStatus,
     )
 from lp.translations.interfaces.translations import (
     TranslationsBranchImportMode,

=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml	2010-10-21 03:22:06 +0000
+++ lib/lp/registry/configure.zcml	2010-10-29 07:12:51 +0000
@@ -156,7 +156,7 @@
         <allow
             interface="lp.soyuz.interfaces.queue.IHasQueueItems"/>
         <allow
-            interface="lp.translations.interfaces.translationimportqueue.IHasTranslationImports"/>
+            interface="lp.translations.interfaces.hastranslationimports.IHasTranslationImports"/>
         <allow
             interface="lp.soyuz.interfaces.publishing.ICanPublishPackages"/>
         <require
@@ -849,7 +849,7 @@
             <allow
                 interface="lp.registry.interfaces.person.ITeamPublic"/>
             <allow
-                interface="lp.translations.interfaces.translationimportqueue.IHasTranslationImports"/>
+                interface="lp.translations.interfaces.hastranslationimports.IHasTranslationImports"/>
             <allow
                 interface="lp.registry.interfaces.person.IHasStanding"/>
             <allow
@@ -1113,7 +1113,7 @@
         <allow
             interface="lp.bugs.interfaces.bugtarget.IHasBugHeat"/>
         <allow
-            interface="lp.translations.interfaces.translationimportqueue.IHasTranslationImports"/>
+            interface="lp.translations.interfaces.hastranslationimports.IHasTranslationImports"/>
         <allow
             interface="lp.translations.interfaces.customlanguagecode.IHasCustomLanguageCodes"/>
         <require
@@ -1383,7 +1383,7 @@
         <allow
             interface="lp.bugs.interfaces.bugtarget.IHasBugHeat"/>
         <allow
-            interface="lp.translations.interfaces.translationimportqueue.IHasTranslationImports"/>
+            interface="lp.translations.interfaces.hastranslationimports.IHasTranslationImports"/>
         <require
             permission="launchpad.Edit"
             set_schema="lp.app.interfaces.launchpad.IServiceUsage"/>
@@ -1448,7 +1448,7 @@
         <allow
             interface="lp.bugs.interfaces.bugtarget.IHasBugHeat"/>
         <allow
-            interface="lp.translations.interfaces.translationimportqueue.IHasTranslationImports"/>
+            interface="lp.translations.interfaces.hastranslationimports.IHasTranslationImports"/>
         <require
             permission="launchpad.Edit"
             interface="lp.registry.interfaces.distribution.IDistributionEditRestricted"/>
@@ -1596,7 +1596,7 @@
         <allow
             interface="lp.soyuz.interfaces.buildrecords.IHasBuildRecords"/>
         <allow
-            interface="lp.translations.interfaces.translationimportqueue.IHasTranslationImports"/>
+            interface="lp.translations.interfaces.hastranslationimports.IHasTranslationImports"/>
 
         <!-- IQuestionTarget -->
 

=== modified file 'lib/lp/registry/doc/distribution.txt'
--- lib/lp/registry/doc/distribution.txt	2010-10-17 15:44:08 +0000
+++ lib/lp/registry/doc/distribution.txt	2010-10-29 07:12:51 +0000
@@ -18,7 +18,7 @@
 
     >>> from lp.registry.interfaces.distribution import (
     ...     IDistribution, IDistributionSet)
-    >>> from lp.translations.interfaces.translationimportqueue import (
+    >>> from lp.translations.interfaces.hastranslationimports import (
     ...     IHasTranslationImports)
     >>> distroset = getUtility(IDistributionSet)
 

=== modified file 'lib/lp/registry/doc/distroseries.txt'
--- lib/lp/registry/doc/distroseries.txt	2010-10-19 18:44:31 +0000
+++ lib/lp/registry/doc/distroseries.txt	2010-10-29 07:12:51 +0000
@@ -27,7 +27,7 @@
     ...     IDistroSeries,
     ...     IDistroSeriesSet,
     ...     )
-    >>> from lp.translations.interfaces.translationimportqueue import (
+    >>> from lp.translations.interfaces.hastranslationimports import (
     ...     IHasTranslationImports)
     >>> distroseriesset = getUtility(IDistroSeriesSet)
 

=== modified file 'lib/lp/registry/doc/person.txt'
--- lib/lp/registry/doc/person.txt	2010-10-19 18:44:31 +0000
+++ lib/lp/registry/doc/person.txt	2010-10-29 07:12:51 +0000
@@ -14,7 +14,7 @@
     ...     IPersonSet,
     ...     )
     >>> from lp.registry.interfaces.product import IProductSet
-    >>> from lp.translations.interfaces.translationimportqueue import (
+    >>> from lp.translations.interfaces.hastranslationimports import (
     ...     IHasTranslationImports)
 
 Any Person object (either a person or a team) implements IPerson...

=== modified file 'lib/lp/registry/doc/product.txt'
--- lib/lp/registry/doc/product.txt	2010-10-19 18:44:31 +0000
+++ lib/lp/registry/doc/product.txt	2010-10-29 07:12:51 +0000
@@ -12,7 +12,7 @@
     ...     IProduct,
     ...     IProductSet,
     ...     )
-    >>> from lp.translations.interfaces.translationimportqueue import (
+    >>> from lp.translations.interfaces.hastranslationimports import (
     ...     IHasTranslationImports)
     >>> from canonical.launchpad.ftests import login
     >>> from canonical.launchpad.webapp.testing import verifyObject

=== modified file 'lib/lp/registry/doc/productseries.txt'
--- lib/lp/registry/doc/productseries.txt	2010-10-19 18:44:31 +0000
+++ lib/lp/registry/doc/productseries.txt	2010-10-29 07:12:51 +0000
@@ -11,7 +11,7 @@
     >>> from lp.registry.interfaces.person import IPersonSet
     >>> from lp.registry.interfaces.product import IProductSet
     >>> from lp.registry.interfaces.productseries import IProductSeries
-    >>> from lp.translations.interfaces.translationimportqueue import (
+    >>> from lp.translations.interfaces.hastranslationimports import (
     ...     IHasTranslationImports)
     >>> from canonical.database.sqlbase import flush_database_updates
 

=== modified file 'lib/lp/registry/doc/sourcepackage.txt'
--- lib/lp/registry/doc/sourcepackage.txt	2010-10-03 15:30:06 +0000
+++ lib/lp/registry/doc/sourcepackage.txt	2010-10-29 07:12:51 +0000
@@ -543,7 +543,7 @@
 SourcePackage implements IHasTranslationImports interface:
 
     >>> from canonical.launchpad.webapp.testing import verifyObject
-    >>> from lp.translations.interfaces.translationimportqueue import (
+    >>> from lp.translations.interfaces.hastranslationimports import (
     ...     IHasTranslationImports)
     >>> IHasTranslationImports.providedBy(warty_firefox)
     True

=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py	2010-10-27 22:33:01 +0000
+++ lib/lp/testing/factory.py	2010-10-29 07:12:51 +0000
@@ -259,14 +259,12 @@
     temp_dir,
     time_counter,
     )
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.potemplate import IPOTemplateSet
 from lp.translations.interfaces.translationfileformat import (
     TranslationFileFormat,
     )
 from lp.translations.interfaces.translationgroup import ITranslationGroupSet
-from lp.translations.interfaces.translationimportqueue import (
-    RosettaImportStatus,
-    )
 from lp.translations.interfaces.translationsperson import ITranslationsPerson
 from lp.translations.interfaces.translationtemplatesbuildjob import (
     ITranslationTemplatesBuildJobSource,

=== modified file 'lib/lp/translations/browser/hastranslationimports.py'
--- lib/lp/translations/browser/hastranslationimports.py	2010-08-24 10:45:57 +0000
+++ lib/lp/translations/browser/hastranslationimports.py	2010-10-29 07:12:51 +0000
@@ -40,10 +40,12 @@
 from lp.registry.interfaces.distribution import IDistribution
 from lp.registry.interfaces.pillar import IPillarNameSet
 from lp.services.propertycache import cachedproperty
+from lp.translations.enums import RosettaImportStatus
+from lp.translations.interfaces.hastranslationimports import (
+    IHasTranslationImports,
+    )
 from lp.translations.interfaces.translationimportqueue import (
-    IHasTranslationImports,
     ITranslationImportQueue,
-    RosettaImportStatus,
     SpecialTranslationImportTargetFilter,
     )
 

=== modified file 'lib/lp/translations/browser/translationimportqueue.py'
--- lib/lp/translations/browser/translationimportqueue.py	2010-09-27 20:47:58 +0000
+++ lib/lp/translations/browser/translationimportqueue.py	2010-10-29 07:12:51 +0000
@@ -47,13 +47,13 @@
 from lp.translations.browser.hastranslationimports import (
     HasTranslationImportsView,
     )
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.pofile import IPOFileSet
 from lp.translations.interfaces.potemplate import IPOTemplateSet
 from lp.translations.interfaces.translationimportqueue import (
     IEditTranslationImportQueueEntry,
     ITranslationImportQueue,
     ITranslationImportQueueEntry,
-    RosettaImportStatus,
     SpecialTranslationImportTargetFilter,
     TranslationFileType,
     )

=== modified file 'lib/lp/translations/doc/poexport-language-pack.txt'
--- lib/lp/translations/doc/poexport-language-pack.txt	2010-10-18 22:24:59 +0000
+++ lib/lp/translations/doc/poexport-language-pack.txt	2010-10-29 07:12:51 +0000
@@ -162,8 +162,9 @@
 We need to import an XPI template and a translation to see those files
 exported as part of language packs.
 
+    >>> from lp.translations.enums import RosettaImportStatus
     >>> from lp.translations.interfaces.translationimportqueue import (
-    ...     ITranslationImportQueue, RosettaImportStatus)
+    ...     ITranslationImportQueue)
     >>> from lp.translations.utilities.tests.test_xpi_import \
     ...     import get_en_US_xpi_file_to_import
 

=== modified file 'lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt'
--- lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt	2010-10-05 00:08:16 +0000
+++ lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt	2010-10-29 07:12:51 +0000
@@ -23,8 +23,9 @@
     >>> from canonical.launchpad.interfaces.launchpad import (
     ...     ILaunchpadCelebrities)
     >>> from lp.registry.interfaces.person import IPersonSet
+    >>> from lp.translations.enums import RosettaImportStatus
     >>> from lp.translations.interfaces.translationimportqueue import (
-    ...     ITranslationImportQueue, RosettaImportStatus)
+    ...     ITranslationImportQueue)
     >>> from lp.translations.model.potemplate import POTemplateSubset
     >>> import pytz
     >>> UTC = pytz.timezone('UTC')

=== modified file 'lib/lp/translations/doc/poimport-pofile-old-po-imported.txt'
--- lib/lp/translations/doc/poimport-pofile-old-po-imported.txt	2010-02-26 21:58:15 +0000
+++ lib/lp/translations/doc/poimport-pofile-old-po-imported.txt	2010-10-29 07:12:51 +0000
@@ -31,8 +31,7 @@
 
 And also, the DBSchema to change the imports status
 
-    >>> from lp.translations.interfaces.translationimportqueue import (
-    ...     RosettaImportStatus)
+    >>> from lp.translations.enums import RosettaImportStatus
 
 Login as an admin to be able to do changes to the import queue.
 

=== modified file 'lib/lp/translations/doc/poimport-pofile-syntax-error.txt'
--- lib/lp/translations/doc/poimport-pofile-syntax-error.txt	2010-10-05 00:08:16 +0000
+++ lib/lp/translations/doc/poimport-pofile-syntax-error.txt	2010-10-29 07:12:51 +0000
@@ -26,8 +26,7 @@
 
 And also, the DBSchema to change the imports status
 
-    >>> from lp.translations.interfaces.translationimportqueue import (
-    ...     RosettaImportStatus)
+    >>> from lp.translations.enums import RosettaImportStatus
 
 Login as an admin to be able to do changes to the import queue.
 

=== modified file 'lib/lp/translations/doc/poimport-potemplate-syntax-error.txt'
--- lib/lp/translations/doc/poimport-potemplate-syntax-error.txt	2010-02-26 21:58:15 +0000
+++ lib/lp/translations/doc/poimport-potemplate-syntax-error.txt	2010-10-29 07:12:51 +0000
@@ -25,8 +25,7 @@
 
 And also, the DBSchema to change the imports status
 
-    >>> from lp.translations.interfaces.translationimportqueue import (
-    ...     RosettaImportStatus)
+    >>> from lp.translations.enums import RosettaImportStatus
 
 Login as an admin to be able to do changes to the import queue.
 

=== modified file 'lib/lp/translations/doc/poimport.txt'
--- lib/lp/translations/doc/poimport.txt	2010-10-18 22:24:59 +0000
+++ lib/lp/translations/doc/poimport.txt	2010-10-29 07:12:51 +0000
@@ -16,8 +16,9 @@
     >>> from lp.registry.interfaces.person import IPersonSet
     >>> from lp.registry.interfaces.product import IProductSet
     >>> from lp.services.worlddata.interfaces.language import ILanguageSet
+    >>> from lp.translations.enums import RosettaImportStatus
     >>> from lp.translations.interfaces.translationimportqueue import (
-    ...     ITranslationImportQueue, RosettaImportStatus)
+    ...     ITranslationImportQueue)
     >>> from lp.registry.model.sourcepackagename import SourcePackageName
     >>> from lp.translations.model.potemplate import POTemplateSubset
     >>> from lp.translations.scripts.po_import import TranslationsImport

=== modified file 'lib/lp/translations/doc/rosetta-karma.txt'
--- lib/lp/translations/doc/rosetta-karma.txt	2010-10-18 22:24:59 +0000
+++ lib/lp/translations/doc/rosetta-karma.txt	2010-10-29 07:12:51 +0000
@@ -11,8 +11,9 @@
     ...     ILaunchpadCelebrities)
     >>> from lp.registry.interfaces.karma import IKarmaActionSet
     >>> from lp.registry.interfaces.person import IPersonSet
+    >>> from lp.translations.enums import RosettaImportStatus
     >>> from lp.translations.interfaces.translationimportqueue import (
-    ...     ITranslationImportQueue, RosettaImportStatus)
+    ...     ITranslationImportQueue)
     >>> from canonical.database.sqlbase import flush_database_caches
     >>> from lp.translations.model.potemplate import POTemplate
 

=== modified file 'lib/lp/translations/doc/rosetta-poimport-script.txt'
--- lib/lp/translations/doc/rosetta-poimport-script.txt	2010-10-05 00:08:16 +0000
+++ lib/lp/translations/doc/rosetta-poimport-script.txt	2010-10-29 07:12:51 +0000
@@ -5,9 +5,10 @@
     >>> from canonical.launchpad.interfaces.launchpad import (
     ...     ILaunchpadCelebrities)
     >>> from lp.registry.interfaces.person import IPersonSet
+    >>> from lp.translations.enums import RosettaImportStatus
     >>> from lp.translations.interfaces.translationimportqueue import (
     ...     ITranslationImportQueue,
-    ...     RosettaImportStatus)
+    ...     )
     >>> from canonical.config import config
     >>> import datetime
     >>> import pytz

=== modified file 'lib/lp/translations/doc/translationimportqueue.txt'
--- lib/lp/translations/doc/translationimportqueue.txt	2010-10-18 22:24:59 +0000
+++ lib/lp/translations/doc/translationimportqueue.txt	2010-10-29 07:12:51 +0000
@@ -34,8 +34,9 @@
     >>> from lp.registry.interfaces.product import IProductSet
     >>> from lp.registry.interfaces.sourcepackagename import (
     ...     ISourcePackageNameSet)
+    >>> from lp.translations.enums import RosettaImportStatus
     >>> from lp.translations.interfaces.translationimportqueue import (
-    ...     ITranslationImportQueue, RosettaImportStatus)
+    ...     ITranslationImportQueue)
     >>> from lp.registry.model.distroseries import DistroSeries
     >>> from lp.registry.model.productseries import ProductSeries
     >>> from lp.registry.model.sourcepackagename import SourcePackageName

=== added file 'lib/lp/translations/enums.py'
--- lib/lp/translations/enums.py	1970-01-01 00:00:00 +0000
+++ lib/lp/translations/enums.py	2010-10-29 07:12:51 +0000
@@ -0,0 +1,67 @@
+# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Enumerations used in the lp/translations modules."""
+
+__metaclass__ = type
+__all__ = [
+    'RosettaImportStatus',
+    ]
+
+from lazr.enum import (
+    DBEnumeratedType,
+    DBItem,
+    )
+
+
+class RosettaImportStatus(DBEnumeratedType):
+    """Rosetta Import Status
+
+    Define the status of an import on the Import queue. It could have one
+    of the following states: approved, imported, deleted, failed, needs_review
+    or blocked.
+    """
+
+    APPROVED = DBItem(1, """
+        Approved
+
+        The entry has been approved by a Rosetta Expert or was able to be
+        approved by our automatic system and is waiting to be imported.
+        """)
+
+    IMPORTED = DBItem(2, """
+        Imported
+
+        The entry has been imported.
+        """)
+
+    DELETED = DBItem(3, """
+        Deleted
+
+        The entry has been removed before being imported.
+        """)
+
+    FAILED = DBItem(4, """
+        Failed
+
+        The entry import failed.
+        """)
+
+    NEEDS_REVIEW = DBItem(5, """
+        Needs Review
+
+        A Rosetta Expert needs to review this entry to decide whether it will
+        be imported and where it should be imported.
+        """)
+
+    BLOCKED = DBItem(6, """
+        Blocked
+
+        The entry has been blocked to be imported by a Rosetta Expert.
+        """)
+
+    NEEDS_INFORMATION = DBItem(7, """
+        Needs Information
+
+        The reviewer needs more information before this entry can be approved.
+        """)

=== added file 'lib/lp/translations/interfaces/hastranslationimports.py'
--- lib/lp/translations/interfaces/hastranslationimports.py	1970-01-01 00:00:00 +0000
+++ lib/lp/translations/interfaces/hastranslationimports.py	2010-10-29 07:12:51 +0000
@@ -0,0 +1,64 @@
+# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""The `IHasTranslationImports` interface."""
+
+__metaclass__ = type
+__all__ = [
+    'IHasTranslationImports',
+    ]
+
+from lazr.restful.declarations import (
+    export_as_webservice_entry,
+    export_read_operation,
+    operation_parameters,
+    operation_returns_collection_of,
+    )
+from zope.interface import Interface
+from zope.schema import (
+    Choice,
+    TextLine,
+    )
+
+from canonical.launchpad import _
+from lp.translations.enums import RosettaImportStatus
+
+
+class IHasTranslationImports(Interface):
+    """An entity on which a translation import queue entry is attached.
+
+    Examples include `ProductSeries`, `SourcePackage`, `DistroSeries`,
+    and `Person`.
+    """
+    export_as_webservice_entry(
+        singular_name='object_with_translation_imports',
+        plural_name='objects_with_translation_imports')
+
+    def getFirstEntryToImport():
+        """Return the first entry of the queue ready to be imported."""
+
+    @operation_parameters(
+        import_status=Choice(
+            title=_("Status"),
+            description=_("Show only entries with this status"),
+            vocabulary=RosettaImportStatus,
+            required=False),
+        file_extension=TextLine(
+            title=_("Filename extension"),
+            description=_("Show only entries with this filename suffix"),
+            required=False))
+    # Really ITranslationImportQueueEntry.  Fixed up in
+    # _schema_circular_imports.py.
+    @operation_returns_collection_of(Interface)
+    @export_read_operation()
+    def getTranslationImportQueueEntries(import_status=None,
+                                         file_extension=None):
+        """Return entries in the translation import queue for this entity.
+
+        :arg import_status: RosettaImportStatus DB Schema entry.
+        :arg file_extension: String with the file type extension, usually 'po'
+            or 'pot'.
+
+        If one of both of 'import_status' or 'file_extension' are given, the
+        returned entries are filtered based on those values.
+        """

=== modified file 'lib/lp/translations/interfaces/translationimportqueue.py'
--- lib/lp/translations/interfaces/translationimportqueue.py	2010-10-22 04:21:37 +0000
+++ lib/lp/translations/interfaces/translationimportqueue.py	2010-10-29 07:12:51 +0000
@@ -48,6 +48,10 @@
 from lp.registry.interfaces.productseries import IProductSeries
 from lp.registry.interfaces.sourcepackage import ISourcePackage
 from lp.services.fields import PersonChoice
+from lp.translations.enums import RosettaImportStatus
+from lp.translations.interfaces.hastranslationimports import (
+    IHasTranslationImports,
+    )
 from lp.translations.interfaces.translationcommonformat import (
     TranslationImportExportBaseException,
     )
@@ -63,8 +67,6 @@
     'ITranslationImportQueueEntry',
     'ITranslationImportQueue',
     'IEditTranslationImportQueueEntry',
-    'IHasTranslationImports',
-    'RosettaImportStatus',
     'SpecialTranslationImportTargetFilter',
     'TranslationFileType',
     'translation_import_queue_entry_age',
@@ -87,59 +89,6 @@
     webservice_error(401) # HTTP Error: 'Unauthorized'
 
 
-class RosettaImportStatus(DBEnumeratedType):
-    """Rosetta Import Status
-
-    Define the status of an import on the Import queue. It could have one
-    of the following states: approved, imported, deleted, failed, needs_review
-    or blocked.
-    """
-
-    APPROVED = DBItem(1, """
-        Approved
-
-        The entry has been approved by a Rosetta Expert or was able to be
-        approved by our automatic system and is waiting to be imported.
-        """)
-
-    IMPORTED = DBItem(2, """
-        Imported
-
-        The entry has been imported.
-        """)
-
-    DELETED = DBItem(3, """
-        Deleted
-
-        The entry has been removed before being imported.
-        """)
-
-    FAILED = DBItem(4, """
-        Failed
-
-        The entry import failed.
-        """)
-
-    NEEDS_REVIEW = DBItem(5, """
-        Needs Review
-
-        A Rosetta Expert needs to review this entry to decide whether it will
-        be imported and where it should be imported.
-        """)
-
-    BLOCKED = DBItem(6, """
-        Blocked
-
-        The entry has been blocked to be imported by a Rosetta Expert.
-        """)
-
-    NEEDS_INFORMATION = DBItem(7, """
-        Needs Information
-
-        The reviewer needs more information before this entry can be approved.
-        """)
-
-
 # Some time spans in days.
 DAYS_IN_MONTH = 30
 DAYS_IN_HALF_YEAR = 366 / 2
@@ -172,46 +121,6 @@
         """)
 
 
-class IHasTranslationImports(Interface):
-    """An entity on which a translation import queue entry is attached.
-
-    Examples include ProductSeries, SourcePackage, DistroSeries, and
-    Person.
-    """
-    export_as_webservice_entry(
-        singular_name='object_with_translation_imports',
-        plural_name='objects_with_translation_imports')
-
-    def getFirstEntryToImport():
-        """Return the first entry of the queue ready to be imported."""
-
-    @operation_parameters(
-        import_status=Choice(
-            title=_("Status"),
-            description=_("Show only entries with this status"),
-            vocabulary=RosettaImportStatus,
-            required=False),
-        file_extension=TextLine(
-            title=_("Filename extension"),
-            description=_("Show only entries with this filename suffix"),
-            required=False))
-    # Really ITranslationImportQueueEntry.  Fixed up in
-    # _schema_circular_imports.py.
-    @operation_returns_collection_of(Interface)
-    @export_read_operation()
-    def getTranslationImportQueueEntries(import_status=None,
-                                         file_extension=None):
-        """Return entries in the translation import queue for this entity.
-
-        :arg import_status: RosettaImportStatus DB Schema entry.
-        :arg file_extension: String with the file type extension, usually 'po'
-            or 'pot'.
-
-        If one of both of 'import_status' or 'file_extension' are given, the
-        returned entries are filtered based on those values.
-        """
-
-
 class ITranslationImportQueueEntry(Interface):
     """An entry of the Translation Import Queue."""
     export_as_webservice_entry(

=== modified file 'lib/lp/translations/interfaces/webservice.py'
--- lib/lp/translations/interfaces/webservice.py	2010-08-20 20:31:18 +0000
+++ lib/lp/translations/interfaces/webservice.py	2010-10-29 07:12:51 +0000
@@ -13,10 +13,12 @@
     'ITranslationImportQueueEntry',
     ]
 
+from lp.translations.interfaces.hastranslationimports import (
+    IHasTranslationImports,
+    )
 from lp.translations.interfaces.pofile import IPOFile
 from lp.translations.interfaces.potemplate import IPOTemplate
 from lp.translations.interfaces.translationimportqueue import (
-    IHasTranslationImports,
     ITranslationImportQueue,
     ITranslationImportQueueEntry,
     )

=== modified file 'lib/lp/translations/model/approver.py'
--- lib/lp/translations/model/approver.py	2010-08-20 20:31:18 +0000
+++ lib/lp/translations/model/approver.py	2010-10-29 07:12:51 +0000
@@ -12,10 +12,8 @@
 from zope.component import getUtility
 
 from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.potemplate import IPOTemplateSet
-from lp.translations.interfaces.translationimportqueue import (
-    RosettaImportStatus,
-    )
 from lp.translations.utilities.template import (
     make_domain,
     make_name,

=== modified file 'lib/lp/translations/model/pofile.py'
--- lib/lp/translations/model/pofile.py	2010-09-03 16:01:01 +0000
+++ lib/lp/translations/model/pofile.py	2010-10-29 07:12:51 +0000
@@ -70,6 +70,7 @@
 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.interfaces.pofile import (
     IPOFile,
     IPOFileSet,
@@ -84,9 +85,6 @@
 from lp.translations.interfaces.translationexporter import (
     ITranslationExporter,
     )
-from lp.translations.interfaces.translationfileformat import (
-    TranslationFileFormat,
-    )
 from lp.translations.interfaces.translationgroup import TranslationPermission
 from lp.translations.interfaces.translationimporter import (
     ITranslationImporter,
@@ -96,9 +94,6 @@
     TranslationFormatInvalidInputError,
     TranslationFormatSyntaxError,
     )
-from lp.translations.interfaces.translationimportqueue import (
-    RosettaImportStatus,
-    )
 from lp.translations.interfaces.translationmessage import (
     TranslationValidationStatus,
     )
@@ -1164,8 +1159,8 @@
         if import_rejected:
             # There were no imports at all and the user needs to review that
             # file, we tag it as FAILED.
-            entry_to_import.setStatus(RosettaImportStatus.FAILED,
-                                      rosetta_experts)
+            entry_to_import.setStatus(
+                RosettaImportStatus.FAILED, rosetta_experts)
         else:
             if (entry_to_import.is_published and
                 not needs_notification_for_imported):
@@ -1174,8 +1169,8 @@
                 # are needed.
                 subject = None
 
-            entry_to_import.setStatus(RosettaImportStatus.IMPORTED,
-                                      rosetta_experts)
+            entry_to_import.setStatus(
+                RosettaImportStatus.IMPORTED, rosetta_experts)
             # Assign karma to the importer if this is not an automatic import
             # (all automatic imports come from the rosetta expert user) and
             # comes from upstream.

=== modified file 'lib/lp/translations/model/potemplate.py'
--- lib/lp/translations/model/potemplate.py	2010-09-23 14:33:51 +0000
+++ lib/lp/translations/model/potemplate.py	2010-10-29 07:12:51 +0000
@@ -72,6 +72,7 @@
 from lp.services.database.prejoin import prejoin
 from lp.services.propertycache import cachedproperty
 from lp.services.worlddata.model.language import Language
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.pofile import IPOFileSet
 from lp.translations.interfaces.potemplate import (
     IHasTranslationTemplates,
@@ -96,9 +97,6 @@
     TranslationFormatInvalidInputError,
     TranslationFormatSyntaxError,
     )
-from lp.translations.interfaces.translationimportqueue import (
-    RosettaImportStatus,
-    )
 from lp.translations.model.pofile import (
     DummyPOFile,
     POFile,

=== modified file 'lib/lp/translations/model/translationimportqueue.py'
--- lib/lp/translations/model/translationimportqueue.py	2010-10-21 12:50:05 +0000
+++ lib/lp/translations/model/translationimportqueue.py	2010-10-29 07:12:51 +0000
@@ -74,6 +74,10 @@
 from lp.registry.interfaces.series import SeriesStatus
 from lp.registry.interfaces.sourcepackage import ISourcePackage
 from lp.services.worlddata.interfaces.language import ILanguageSet
+from lp.translations.enums import RosettaImportStatus
+from lp.translations.interfaces.hastranslationimports import (
+    IHasTranslationImports,
+    )
 from lp.translations.interfaces.pofile import IPOFileSet
 from lp.translations.interfaces.potemplate import (
     IPOTemplate,
@@ -86,10 +90,8 @@
     ITranslationImporter,
     )
 from lp.translations.interfaces.translationimportqueue import (
-    IHasTranslationImports,
     ITranslationImportQueue,
     ITranslationImportQueueEntry,
-    RosettaImportStatus,
     SpecialTranslationImportTargetFilter,
     translation_import_queue_entry_age,
     TranslationImportQueueConflictError,

=== modified file 'lib/lp/translations/scripts/po_import.py'
--- lib/lp/translations/scripts/po_import.py	2010-09-17 02:44:05 +0000
+++ lib/lp/translations/scripts/po_import.py	2010-10-29 07:12:51 +0000
@@ -26,9 +26,9 @@
 from canonical.launchpad.mailnotification import MailWrapper
 from canonical.launchpad.webapp import errorlog
 from lp.services.scripts.base import LaunchpadCronScript
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.translationimportqueue import (
     ITranslationImportQueue,
-    RosettaImportStatus,
     )
 
 

=== modified file 'lib/lp/translations/scripts/tests/test_translations_import.py'
--- lib/lp/translations/scripts/tests/test_translations_import.py	2010-09-17 08:01:42 +0000
+++ lib/lp/translations/scripts/tests/test_translations_import.py	2010-10-29 07:12:51 +0000
@@ -12,9 +12,7 @@
 from lp.services.mail import stub
 from lp.testing import TestCaseWithFactory
 from lp.testing.fakemethod import FakeMethod
-from lp.translations.interfaces.translationimportqueue import (
-    RosettaImportStatus,
-    )
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.model.translationimportqueue import (
     TranslationImportQueue,
     )

=== modified file 'lib/lp/translations/tests/test_autoapproval.py'
--- lib/lp/translations/tests/test_autoapproval.py	2010-10-26 15:47:24 +0000
+++ lib/lp/translations/tests/test_autoapproval.py	2010-10-29 07:12:51 +0000
@@ -34,9 +34,9 @@
     )
 from lp.testing import TestCaseWithFactory
 from lp.testing.fakemethod import FakeMethod
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.customlanguagecode import ICustomLanguageCode
 from lp.translations.interfaces.translationimportqueue import (
-    RosettaImportStatus,
     translation_import_queue_entry_age,
     )
 from lp.translations.model.customlanguagecode import CustomLanguageCode

=== modified file 'lib/lp/translations/tests/test_rosetta_branches_script.py'
--- lib/lp/translations/tests/test_rosetta_branches_script.py	2010-10-26 15:47:24 +0000
+++ lib/lp/translations/tests/test_rosetta_branches_script.py	2010-10-29 07:12:51 +0000
@@ -21,9 +21,9 @@
 from lp.code.model.branchjob import RosettaUploadJob
 from lp.services.osutils import override_environ
 from lp.testing import TestCaseWithFactory
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.translationimportqueue import (
     ITranslationImportQueue,
-    RosettaImportStatus,
     )
 from lp.translations.interfaces.translations import (
     TranslationsBranchImportMode,

=== modified file 'lib/lp/translations/tests/test_translationbranchapprover.py'
--- lib/lp/translations/tests/test_translationbranchapprover.py	2010-10-04 19:50:45 +0000
+++ lib/lp/translations/tests/test_translationbranchapprover.py	2010-10-29 07:12:51 +0000
@@ -14,9 +14,9 @@
 from canonical.launchpad.validators.name import valid_name
 from canonical.testing.layers import LaunchpadZopelessLayer
 from lp.testing import TestCaseWithFactory
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.translationimportqueue import (
     ITranslationImportQueue,
-    RosettaImportStatus,
     )
 from lp.translations.model.approver import TranslationBranchApprover
 

=== modified file 'lib/lp/translations/tests/test_translationbuildapprover.py'
--- lib/lp/translations/tests/test_translationbuildapprover.py	2010-10-05 00:08:16 +0000
+++ lib/lp/translations/tests/test_translationbuildapprover.py	2010-10-29 07:12:51 +0000
@@ -13,9 +13,9 @@
 from canonical.config import config
 from canonical.testing.layers import LaunchpadZopelessLayer
 from lp.testing import TestCaseWithFactory
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.translationimportqueue import (
     ITranslationImportQueue,
-    RosettaImportStatus,
     )
 from lp.translations.model.approver import TranslationBuildApprover
 

=== modified file 'lib/lp/translations/tests/test_translationimportqueue.py'
--- lib/lp/translations/tests/test_translationimportqueue.py	2010-10-26 15:47:24 +0000
+++ lib/lp/translations/tests/test_translationimportqueue.py	2010-10-29 07:12:51 +0000
@@ -19,9 +19,9 @@
     TestCaseWithFactory,
     )
 from lp.testing.factory import LaunchpadObjectFactory
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.translationimportqueue import (
     ITranslationImportQueue,
-    RosettaImportStatus,
     )
 
 

=== modified file 'lib/lp/translations/tests/test_translationtemplatesbuildbehavior.py'
--- lib/lp/translations/tests/test_translationtemplatesbuildbehavior.py	2010-10-27 14:25:19 +0000
+++ lib/lp/translations/tests/test_translationtemplatesbuildbehavior.py	2010-10-29 07:12:51 +0000
@@ -5,7 +5,6 @@
 
 import logging
 import os
-from StringIO import StringIO
 
 from twisted.trial.unittest import TestCase as TrialTestCase
 
@@ -24,7 +23,6 @@
     SlaveTestHelpers,
     WaitingSlave,
     )
-from lp.buildmaster.enums import BuildStatus
 from lp.buildmaster.interfaces.buildfarmjobbehavior import (
     IBuildFarmJobBehavior,
     )
@@ -37,9 +35,9 @@
     )
 from lp.testing.factory import LaunchpadObjectFactory
 from lp.testing.fakemethod import FakeMethod
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.translationimportqueue import (
     ITranslationImportQueue,
-    RosettaImportStatus,
     )
 from lp.translations.interfaces.translations import (
     TranslationsBranchImportMode,

=== modified file 'lib/lp/translations/utilities/tests/helpers.py'
--- lib/lp/translations/utilities/tests/helpers.py	2010-08-20 20:31:18 +0000
+++ lib/lp/translations/utilities/tests/helpers.py	2010-10-29 07:12:51 +0000
@@ -19,9 +19,9 @@
     )
 from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
 from canonical.launchpad.scripts import FakeLogger
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.translationimportqueue import (
     ITranslationImportQueue,
-    RosettaImportStatus,
     )
 
 

=== modified file 'lib/lp/translations/utilities/tests/test_xpi_import.py'
--- lib/lp/translations/utilities/tests/test_xpi_import.py	2010-10-04 19:50:45 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_import.py	2010-10-29 07:12:51 +0000
@@ -13,10 +13,8 @@
 from canonical.testing.layers import LaunchpadZopelessLayer
 from lp.registry.interfaces.person import IPersonSet
 from lp.registry.interfaces.product import IProductSet
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.potemplate import IPOTemplateSet
-from lp.translations.interfaces.translationimportqueue import (
-    RosettaImportStatus,
-    )
 from lp.translations.utilities.mozilla_xpi_importer import MozillaXpiImporter
 from lp.translations.utilities.tests.helpers import (
     import_pofile_or_potemplate,

=== modified file 'lib/lp/translations/utilities/tests/test_xpi_po_exporter.py'
--- lib/lp/translations/utilities/tests/test_xpi_po_exporter.py	2010-10-04 19:50:45 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_po_exporter.py	2010-10-29 07:12:51 +0000
@@ -18,6 +18,7 @@
 from canonical.testing.layers import LaunchpadZopelessLayer
 from lp.registry.interfaces.person import IPersonSet
 from lp.registry.interfaces.product import IProductSet
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.potemplate import IPOTemplateSet
 from lp.translations.interfaces.translationcommonformat import (
     ITranslationFileData,
@@ -27,7 +28,6 @@
     )
 from lp.translations.interfaces.translationimportqueue import (
     ITranslationImportQueue,
-    RosettaImportStatus,
     )
 from lp.translations.utilities.tests.test_xpi_import import (
     get_en_US_xpi_file_to_import,

=== modified file 'lib/lp/translations/utilities/tests/test_xpi_search.py'
--- lib/lp/translations/utilities/tests/test_xpi_search.py	2010-10-04 19:50:45 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_search.py	2010-10-29 07:12:51 +0000
@@ -11,10 +11,8 @@
 from canonical.testing.layers import LaunchpadZopelessLayer
 from lp.registry.interfaces.person import IPersonSet
 from lp.registry.interfaces.product import IProductSet
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.potemplate import IPOTemplateSet
-from lp.translations.interfaces.translationimportqueue import (
-    RosettaImportStatus,
-    )
 from lp.translations.utilities.tests.helpers import (
     import_pofile_or_potemplate,
     )

=== modified file 'lib/lp/translations/utilities/translation_import.py'
--- lib/lp/translations/utilities/translation_import.py	2010-09-03 13:16:51 +0000
+++ lib/lp/translations/utilities/translation_import.py	2010-10-29 07:12:51 +0000
@@ -43,9 +43,7 @@
     NotExportedFromLaunchpad,
     OutdatedTranslationError,
     )
-from lp.translations.interfaces.translationimportqueue import (
-    RosettaImportStatus,
-    )
+from lp.translations.enums import RosettaImportStatus
 from lp.translations.interfaces.translationmessage import TranslationConflict
 from lp.translations.interfaces.translations import TranslationConstants
 from lp.translations.utilities.gettext_po_importer import GettextPOImporter