← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~thumper/launchpad/move-branch-errors into lp:launchpad/devel

 

Tim Penhey has proposed merging lp:~thumper/launchpad/move-branch-errors into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


Some more simple error moving.
-- 
https://code.launchpad.net/~thumper/launchpad/move-branch-errors/+merge/31602
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~thumper/launchpad/move-branch-errors into lp:launchpad/devel.
=== modified file 'lib/canonical/launchpad/browser/launchpad.py'
--- lib/canonical/launchpad/browser/launchpad.py	2010-08-02 01:37:09 +0000
+++ lib/canonical/launchpad/browser/launchpad.py	2010-08-03 04:01:43 +0000
@@ -80,12 +80,11 @@
 from lp.bugs.interfaces.bug import IBugSet
 from lp.bugs.interfaces.malone import IMaloneApplication
 from lp.buildmaster.interfaces.builder import IBuilderSet
+from lp.code.errors import (
+    CannotHaveLinkedBranch, InvalidNamespace, NoLinkedBranch)
 from lp.code.interfaces.branch import IBranchSet
 from lp.code.interfaces.branchlookup import IBranchLookup
-from lp.code.interfaces.branchnamespace import InvalidNamespace
 from lp.code.interfaces.codeimport import ICodeImportSet
-from lp.code.interfaces.linkedbranch import (
-    CannotHaveLinkedBranch, NoLinkedBranch)
 from lp.hardwaredb.interfaces.hwdb import IHWDBApplication
 from lp.registry.interfaces.codeofconduct import ICodeOfConductSet
 from lp.registry.interfaces.distribution import IDistributionSet

=== modified file 'lib/lp/code/errors.py'
--- lib/lp/code/errors.py	2010-08-02 02:51:42 +0000
+++ lib/lp/code/errors.py	2010-08-03 04:01:43 +0000
@@ -20,12 +20,15 @@
     'BuildNotAllowedForDistro',
     'BranchMergeProposalExists',
     'CannotDeleteBranch',
+    'CannotHaveLinkedBranch',
     'CodeImportAlreadyRequested',
     'CodeImportAlreadyRunning',
     'CodeImportNotInReviewedState',
     'ClaimReviewFailed',
     'ForbiddenInstruction',
     'InvalidBranchMergeProposal',
+    'InvalidNamespace',
+    'NoLinkedBranch',
     'NoSuchBranch',
     'PrivateBranchRecipe',
     'ReviewNotPending',
@@ -131,10 +134,13 @@
     """The branch cannot be made private."""
 
 
-class NoSuchBranch(NameLookupFailed):
-    """Raised when we try to load a branch that does not exist."""
+class CannotHaveLinkedBranch(Exception):
+    """Raised when we try to get the linked branch for a thing that can't."""
 
-    _message_prefix = "No such branch"
+    def __init__(self, component):
+        self.component = component
+        Exception.__init__(
+            self, "%r cannot have linked branches." % (component,))
 
 
 class ClaimReviewFailed(Exception):
@@ -154,6 +160,33 @@
     webservice_error(400) #Bad request.
 
 
+class InvalidNamespace(Exception):
+    """Raised when someone tries to lookup a namespace with a bad name.
+
+    By 'bad', we mean that the name is unparseable. It might be too short, too
+    long or malformed in some other way.
+    """
+
+    def __init__(self, name):
+        self.name = name
+        Exception.__init__(
+            self, "Cannot understand namespace name: '%s'" % (name,))
+
+
+class NoLinkedBranch(Exception):
+    """Raised when there's no linked branch for a thing."""
+
+    def __init__(self, component):
+        self.component = component
+        Exception.__init__(self, "%r has no linked branch." % (component,))
+
+
+class NoSuchBranch(NameLookupFailed):
+    """Raised when we try to load a branch that does not exist."""
+
+    _message_prefix = "No such branch"
+
+
 class PrivateBranchRecipe(Exception):
 
     def __init__(self, branch):

=== modified file 'lib/lp/code/interfaces/branchnamespace.py'
--- lib/lp/code/interfaces/branchnamespace.py	2009-08-13 15:12:16 +0000
+++ lib/lp/code/interfaces/branchnamespace.py	2010-08-03 04:01:43 +0000
@@ -11,7 +11,6 @@
     'IBranchNamespace',
     'IBranchNamespacePolicy',
     'IBranchNamespaceSet',
-    'InvalidNamespace',
     'lookup_branch_namespace',
     'split_unique_name',
     ]
@@ -281,19 +280,6 @@
         """
 
 
-class InvalidNamespace(Exception):
-    """Raised when someone tries to lookup a namespace with a bad name.
-
-    By 'bad', we mean that the name is unparseable. It might be too short, too
-    long or malformed in some other way.
-    """
-
-    def __init__(self, name):
-        self.name = name
-        Exception.__init__(
-            self, "Cannot understand namespace name: '%s'" % (name,))
-
-
 def get_branch_namespace(person, product=None, distroseries=None,
                          sourcepackagename=None):
     return getUtility(IBranchNamespaceSet).get(

=== modified file 'lib/lp/code/interfaces/linkedbranch.py'
--- lib/lp/code/interfaces/linkedbranch.py	2010-04-07 20:43:03 +0000
+++ lib/lp/code/interfaces/linkedbranch.py	2010-08-03 04:01:43 +0000
@@ -12,15 +12,15 @@
 
 __metaclass__ = type
 __all__ = [
-    'CannotHaveLinkedBranch',
     'get_linked_branch',
     'ICanHasLinkedBranch',
-    'NoLinkedBranch',
     ]
 
 from zope.interface import Attribute, Interface
 from zope.security.proxy import isinstance as zope_isinstance
 
+from lp.code.errors import CannotHaveLinkedBranch, NoLinkedBranch
+
 
 class ICanHasLinkedBranch(Interface):
     """Something that has a linked branch."""
@@ -41,23 +41,6 @@
         """
 
 
-class CannotHaveLinkedBranch(Exception):
-    """Raised when we try to get the linked branch for a thing that can't."""
-
-    def __init__(self, component):
-        self.component = component
-        Exception.__init__(
-            self, "%r cannot have linked branches." % (component,))
-
-
-class NoLinkedBranch(Exception):
-    """Raised when there's no linked branch for a thing."""
-
-    def __init__(self, component):
-        self.component = component
-        Exception.__init__(self, "%r has no linked branch." % (component,))
-
-
 def get_linked_branch(provided):
     """Get the linked branch for 'provided', whatever that is.
 

=== modified file 'lib/lp/code/model/branchlookup.py'
--- lib/lp/code/model/branchlookup.py	2010-08-02 02:36:32 +0000
+++ lib/lp/code/model/branchlookup.py	2010-08-03 04:01:43 +0000
@@ -21,13 +21,12 @@
 from lp.registry.model.person import Person
 from lp.registry.model.product import Product
 from lp.registry.model.sourcepackagename import SourcePackageName
-from lp.code.errors import NoSuchBranch
+from lp.code.errors import (
+    CannotHaveLinkedBranch, InvalidNamespace, NoLinkedBranch, NoSuchBranch)
 from lp.code.interfaces.branchlookup import (
     IBranchLookup, ILinkedBranchTraversable, ILinkedBranchTraverser)
-from lp.code.interfaces.branchnamespace import (
-    IBranchNamespaceSet, InvalidNamespace)
-from lp.code.interfaces.linkedbranch import (
-    CannotHaveLinkedBranch, get_linked_branch, NoLinkedBranch)
+from lp.code.interfaces.branchnamespace import IBranchNamespaceSet
+from lp.code.interfaces.linkedbranch import get_linked_branch
 from lp.registry.interfaces.distribution import IDistribution
 from lp.registry.interfaces.distroseries import (
     IDistroSeries, IDistroSeriesSet, NoSuchDistroSeries)

=== modified file 'lib/lp/code/model/branchnamespace.py'
--- lib/lp/code/model/branchnamespace.py	2010-08-02 02:36:32 +0000
+++ lib/lp/code/model/branchnamespace.py	2010-08-03 04:01:43 +0000
@@ -28,11 +28,11 @@
     BranchVisibilityRule, CodeReviewNotificationLevel)
 from lp.code.errors import (
     BranchCreationForbidden, BranchCreatorNotMemberOfOwnerTeam,
-    BranchCreatorNotOwner, BranchExists, NoSuchBranch)
+    BranchCreatorNotOwner, BranchExists, InvalidNamespace, NoSuchBranch)
 from lp.code.interfaces.branch import (
     IBranch, user_has_special_branch_access)
 from lp.code.interfaces.branchnamespace import (
-    IBranchNamespace, IBranchNamespacePolicy, InvalidNamespace)
+    IBranchNamespace, IBranchNamespacePolicy)
 from lp.code.interfaces.branchtarget import IBranchTarget
 from lp.code.model.branch import Branch
 from lp.registry.interfaces.distribution import (

=== modified file 'lib/lp/code/model/tests/test_branchlookup.py'
--- lib/lp/code/model/tests/test_branchlookup.py	2010-08-02 02:36:32 +0000
+++ lib/lp/code/model/tests/test_branchlookup.py	2010-08-03 04:01:43 +0000
@@ -13,13 +13,12 @@
 from zope.security.proxy import removeSecurityProxy
 
 from canonical.config import config
-from lp.code.errors import NoSuchBranch
+from lp.code.errors import (
+    CannotHaveLinkedBranch, InvalidNamespace, NoLinkedBranch, NoSuchBranch)
 from lp.code.interfaces.branchlookup import (
     IBranchLookup, ILinkedBranchTraverser)
-from lp.code.interfaces.branchnamespace import (
-    get_branch_namespace, InvalidNamespace)
-from lp.code.interfaces.linkedbranch import (
-    CannotHaveLinkedBranch, ICanHasLinkedBranch, NoLinkedBranch)
+from lp.code.interfaces.branchnamespace import get_branch_namespace
+from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch
 from lp.registry.interfaces.distroseries import NoSuchDistroSeries
 from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
 from lp.registry.interfaces.person import NoSuchPerson

=== modified file 'lib/lp/code/model/tests/test_branchnamespace.py'
--- lib/lp/code/model/tests/test_branchnamespace.py	2010-08-02 02:36:32 +0000
+++ lib/lp/code/model/tests/test_branchnamespace.py	2010-08-03 04:01:43 +0000
@@ -21,10 +21,10 @@
     BranchLifecycleStatus, BranchType, BranchVisibilityRule)
 from lp.code.errors import (
     BranchCreationForbidden, BranchCreatorNotMemberOfOwnerTeam,
-    BranchCreatorNotOwner, BranchExists, NoSuchBranch)
+    BranchCreatorNotOwner, BranchExists, InvalidNamespace, NoSuchBranch)
 from lp.code.interfaces.branchnamespace import (
     get_branch_namespace, IBranchNamespacePolicy, IBranchNamespace,
-    IBranchNamespaceSet, lookup_branch_namespace, InvalidNamespace)
+    IBranchNamespaceSet, lookup_branch_namespace)
 from lp.code.interfaces.branchtarget import IBranchTarget
 from lp.registry.interfaces.distribution import NoSuchDistribution
 from lp.registry.interfaces.distroseries import NoSuchDistroSeries

=== modified file 'lib/lp/code/xmlrpc/branch.py'
--- lib/lp/code/xmlrpc/branch.py	2010-08-02 02:51:42 +0000
+++ lib/lp/code/xmlrpc/branch.py	2010-08-03 04:01:43 +0000
@@ -23,15 +23,13 @@
 from canonical.launchpad.webapp.interfaces import ILaunchBag
 from lp.code.enums import BranchType
 from lp.code.errors import (
-    BranchCreationException, BranchCreationForbidden, NoSuchBranch)
+    BranchCreationException, BranchCreationForbidden, CannotHaveLinkedBranch,
+    InvalidNamespace, NoLinkedBranch, NoSuchBranch)
 from lp.code.interfaces.branch import IBranch
 from lp.registry.interfaces.person import IPersonSet
 from lp.registry.interfaces.product import IProductSet
 from lp.code.interfaces.branchlookup import IBranchLookup
-from lp.code.interfaces.branchnamespace import (
-    get_branch_namespace, InvalidNamespace)
-from lp.code.interfaces.linkedbranch import (
-    CannotHaveLinkedBranch, NoLinkedBranch)
+from lp.code.interfaces.branchnamespace import get_branch_namespace
 from lp.registry.interfaces.distroseries import NoSuchDistroSeries
 from lp.registry.interfaces.person import NoSuchPerson
 from lp.registry.interfaces.product import (

=== modified file 'lib/lp/code/xmlrpc/codehosting.py'
--- lib/lp/code/xmlrpc/codehosting.py	2010-08-02 02:51:42 +0000
+++ lib/lp/code/xmlrpc/codehosting.py	2010-08-03 04:01:43 +0000
@@ -30,13 +30,13 @@
 from canonical.launchpad.xmlrpc.helpers import return_fault
 
 from lp.app.errors import NameLookupFailed, NotFoundError
-from lp.code.errors import UnknownBranchTypeError
 from lp.code.bzr import BranchFormat, ControlFormat, RepositoryFormat
 from lp.code.enums import BranchType
-from lp.code.errors import BranchCreationException
+from lp.code.errors import (
+    BranchCreationException, InvalidNamespace, UnknownBranchTypeError)
 from lp.code.interfaces.branchlookup import IBranchLookup
 from lp.code.interfaces.branchnamespace import (
-    InvalidNamespace, lookup_branch_namespace, split_unique_name)
+    lookup_branch_namespace, split_unique_name)
 from lp.code.interfaces import branchpuller
 from lp.code.interfaces.codehosting import (
     BRANCH_TRANSPORT, CONTROL_TRANSPORT, ICodehostingAPI, LAUNCHPAD_ANONYMOUS,

=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py	2010-08-02 02:13:52 +0000
+++ lib/lp/registry/browser/person.py	2010-08-03 04:01:43 +0000
@@ -171,8 +171,8 @@
     DAYS_BEFORE_EXPIRATION_WARNING_IS_SENT, ITeamMembership,
     ITeamMembershipSet, TeamMembershipStatus)
 from lp.registry.interfaces.wikiname import IWikiNameSet
-from lp.code.interfaces.branchnamespace import (
-    IBranchNamespaceSet, InvalidNamespace)
+from lp.code.errors import InvalidNamespace
+from lp.code.interfaces.branchnamespace import IBranchNamespaceSet
 from lp.bugs.interfaces.bugtask import IBugTaskSet
 from lp.buildmaster.interfaces.buildbase import BuildStatus
 from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet