← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:move-AlreadyConvertedException into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:move-AlreadyConvertedException into launchpad:master.

Commit message:
Move AlreadyConvertedException to lp.registry.interfaces.person

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398256

Fixes an import policy violation.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:move-AlreadyConvertedException into launchpad:master.
diff --git a/lib/lp/registry/doc/person.txt b/lib/lp/registry/doc/person.txt
index d3702d4..744f56f 100644
--- a/lib/lp/registry/doc/person.txt
+++ b/lib/lp/registry/doc/person.txt
@@ -534,7 +534,7 @@ account_status is NOACCOUNT, though.
     ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
     Traceback (most recent call last):
     ...
-    lp.registry.model.person.AlreadyConvertedException: foo-o has already been converted to a team.
+    lp.registry.interfaces.person.AlreadyConvertedException: foo-o has already been converted to a team.
 
 
 Team members
diff --git a/lib/lp/registry/interfaces/person.py b/lib/lp/registry/interfaces/person.py
index 754a920..39988df 100644
--- a/lib/lp/registry/interfaces/person.py
+++ b/lib/lp/registry/interfaces/person.py
@@ -6,6 +6,7 @@
 __metaclass__ = type
 
 __all__ = [
+    'AlreadyConvertedException',
     'IAdminPeopleMergeSchema',
     'IAdminTeamMergeSchema',
     'ICanonicalSSOAPI',
@@ -2673,6 +2674,10 @@ class ICanonicalSSOAPI(Interface):
         """Get the details of an LP person based on an OpenID identifier."""
 
 
+class AlreadyConvertedException(Exception):
+    """Raised when attempting to claim a team that has been claimed."""
+
+
 @error_status(http_client.FORBIDDEN)
 class ImmutableVisibilityError(Exception):
     """A change in team membership visibility is not allowed."""
diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
index b7c95db..91ec1a6 100644
--- a/lib/lp/registry/model/person.py
+++ b/lib/lp/registry/model/person.py
@@ -5,7 +5,6 @@
 
 __metaclass__ = type
 __all__ = [
-    'AlreadyConvertedException',
     'get_person_visibility_terms',
     'get_recipients',
     'generate_nick',
@@ -187,6 +186,7 @@ from lp.registry.interfaces.mailinglistsubscription import (
     MailingListAutoSubscribePolicy,
     )
 from lp.registry.interfaces.person import (
+    AlreadyConvertedException,
     ImmutableVisibilityError,
     IPerson,
     IPersonSet,
@@ -330,10 +330,6 @@ from lp.translations.model.hastranslationimports import (
     )
 
 
-class AlreadyConvertedException(Exception):
-    """Raised when an attempt to claim a team that has been claimed."""
-
-
 @implementer(IJoinTeamEvent)
 class JoinTeamEvent:
     """See `IJoinTeamEvent`."""
diff --git a/lib/lp/services/verification/browser/logintoken.py b/lib/lp/services/verification/browser/logintoken.py
index b55648d..47317aa 100644
--- a/lib/lp/services/verification/browser/logintoken.py
+++ b/lib/lp/services/verification/browser/logintoken.py
@@ -38,6 +38,7 @@ from lp.app.browser.launchpadform import (
 from lp.app.widgets.itemswidgets import LaunchpadRadioWidget
 from lp.registry.browser.team import HasRenewalPolicyMixin
 from lp.registry.interfaces.person import (
+    AlreadyConvertedException,
     IPersonSet,
     ITeam,
     )
@@ -212,8 +213,6 @@ class ClaimTeamView(
 
     @action(_('Continue'), name='confirm')
     def confirm_action(self, action, data):
-        # Avoid circular imports.
-        from lp.registry.model.person import AlreadyConvertedException
         try:
             self.claimed_profile.convertToTeam(
                 team_owner=self.context.requester)