launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #21680
[Merge] lp:~cjwatson/launchpad/tidy-incompatible-arguments-exception into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/tidy-incompatible-arguments-exception into lp:launchpad.
Commit message:
Move IncompatibleArguments to lp.app.errors, since it isn't Soyuz-specific.
This is possible now that we're using lazr.restful 0.20.0.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/tidy-incompatible-arguments-exception/+merge/326534
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/tidy-incompatible-arguments-exception into lp:launchpad.
=== modified file 'lib/lp/app/configure.zcml'
--- lib/lp/app/configure.zcml 2016-02-05 06:41:16 +0000
+++ lib/lp/app/configure.zcml 2017-06-29 15:06:47 +0000
@@ -1,4 +1,4 @@
-<!-- Copyright 2009-2016 Canonical Ltd. This software is licensed under the
+<!-- Copyright 2009-2017 Canonical Ltd. This software is licensed under the
GNU Affero General Public License version 3 (see the file LICENSE).
-->
@@ -6,6 +6,7 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:i18n="http://namespaces.zope.org/i18n"
+ xmlns:webservice="http://namespaces.canonical.com/webservice"
i18n_domain="launchpad">
<include package=".browser"/>
<include package="lp.app.validators" />
@@ -79,4 +80,6 @@
interface="lp.services.webapp.interfaces.ICanonicalUrlData"/>
</securedutility>
+ <webservice:register module="lp.app.errors" />
+
</configure>
=== modified file 'lib/lp/app/errors.py'
--- lib/lp/app/errors.py 2012-10-03 20:18:39 +0000
+++ lib/lp/app/errors.py 2017-06-29 15:06:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Cross application type errors for launchpad."""
@@ -6,6 +6,7 @@
__metaclass__ = type
__all__ = [
'GoneError',
+ 'IncompatibleArguments',
'NameLookupFailed',
'NotFoundError',
'POSTToNonCanonicalURL',
@@ -87,5 +88,10 @@
"""The specified ServiceUsage is not allowed."""
+@error_status(httplib.BAD_REQUEST)
+class IncompatibleArguments(Exception):
+ """Raised when incompatible arguments are passed to a method."""
+
+
# Slam a 401 response code onto all ForbiddenAttribute errors.
error_status(httplib.UNAUTHORIZED)(ForbiddenAttribute)
=== modified file 'lib/lp/buildmaster/model/builder.py'
--- lib/lp/buildmaster/model/builder.py 2015-09-28 17:38:45 +0000
+++ lib/lp/buildmaster/model/builder.py 2017-06-29 15:06:47 +0000
@@ -37,7 +37,10 @@
from zope.interface import implementer
from zope.security.proxy import removeSecurityProxy
-from lp.app.errors import NotFoundError
+from lp.app.errors import (
+ IncompatibleArguments,
+ NotFoundError,
+ )
from lp.buildmaster.enums import (
BuilderCleanStatus,
BuilderResetProtocol,
@@ -78,10 +81,7 @@
# These dependencies on soyuz will be removed when getBuildRecords()
# is moved.
from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet
-from lp.soyuz.interfaces.buildrecords import (
- IHasBuildRecords,
- IncompatibleArguments,
- )
+from lp.soyuz.interfaces.buildrecords import IHasBuildRecords
@implementer(IBuilder, IHasBuildRecords)
=== modified file 'lib/lp/snappy/model/snap.py'
--- lib/lp/snappy/model/snap.py 2017-04-24 13:38:04 +0000
+++ lib/lp/snappy/model/snap.py 2017-06-29 15:06:47 +0000
@@ -42,6 +42,7 @@
from lp.app.browser.tales import DateTimeFormatterAPI
from lp.app.enums import PRIVATE_INFORMATION_TYPES
+from lp.app.errors import IncompatibleArguments
from lp.app.interfaces.security import IAuthorization
from lp.buildmaster.enums import BuildStatus
from lp.buildmaster.interfaces.buildqueue import IBuildQueueSet
@@ -128,7 +129,6 @@
from lp.snappy.interfaces.snapstoreclient import ISnapStoreClient
from lp.snappy.model.snapbuild import SnapBuild
from lp.soyuz.interfaces.archive import ArchiveDisabled
-from lp.soyuz.interfaces.buildrecords import IncompatibleArguments
from lp.soyuz.model.archive import (
Archive,
get_enabled_archive_filter,
=== modified file 'lib/lp/soyuz/interfaces/buildrecords.py'
--- lib/lp/soyuz/interfaces/buildrecords.py 2016-11-14 19:55:07 +0000
+++ lib/lp/soyuz/interfaces/buildrecords.py 2017-06-29 15:06:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""IHasBuildRecords interface.
@@ -10,13 +10,10 @@
__all__ = [
'IHasBuildRecords',
- 'IncompatibleArguments',
]
-import httplib
from lazr.restful.declarations import (
call_with,
- error_status,
export_read_operation,
operation_for_version,
operation_parameters,
@@ -35,11 +32,6 @@
from lp.registry.interfaces.pocket import PackagePublishingPocket
-@error_status(httplib.BAD_REQUEST)
-class IncompatibleArguments(Exception):
- """Raised when incompatible arguments are passed to a method."""
-
-
class IHasBuildRecords(Interface):
"""An Object that has build records"""
=== modified file 'lib/lp/soyuz/interfaces/webservice.py'
--- lib/lp/soyuz/interfaces/webservice.py 2015-04-20 11:24:21 +0000
+++ lib/lp/soyuz/interfaces/webservice.py 2017-06-29 15:06:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2014 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""All the interfaces that are exposed through the webservice.
@@ -37,7 +37,6 @@
'IPackageset',
'IPackagesetSet',
'ISourcePackagePublishingHistory',
- 'IncompatibleArguments',
'InsufficientUploadRights',
'InvalidComponent',
'InvalidPocketForPPA',
@@ -87,7 +86,6 @@
from lp.soyuz.interfaces.binarypackagerelease import (
IBinaryPackageReleaseDownloadCount,
)
-from lp.soyuz.interfaces.buildrecords import IncompatibleArguments
from lp.soyuz.interfaces.distroarchseries import IDistroArchSeries
from lp.soyuz.interfaces.livefs import (
ILiveFS,
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2016-11-12 22:32:36 +0000
+++ lib/lp/soyuz/model/archive.py 2017-06-29 15:06:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Database class for table Archive."""
@@ -53,7 +53,10 @@
from zope.security.interfaces import Unauthorized
from zope.security.proxy import removeSecurityProxy
-from lp.app.errors import NotFoundError
+from lp.app.errors import (
+ IncompatibleArguments,
+ NotFoundError,
+ )
from lp.app.interfaces.launchpad import ILaunchpadCelebrities
from lp.app.interfaces.security import IAuthorization
from lp.app.validators.name import valid_name
@@ -182,10 +185,7 @@
IArchiveSubscriberSet,
)
from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet
-from lp.soyuz.interfaces.buildrecords import (
- IHasBuildRecords,
- IncompatibleArguments,
- )
+from lp.soyuz.interfaces.buildrecords import IHasBuildRecords
from lp.soyuz.interfaces.component import (
IComponent,
IComponentSet,
=== modified file 'lib/lp/soyuz/tests/test_hasbuildrecords.py'
--- lib/lp/soyuz/tests/test_hasbuildrecords.py 2015-09-28 17:38:45 +0000
+++ lib/lp/soyuz/tests/test_hasbuildrecords.py 2017-06-29 15:06:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test implementations of the IHasBuildRecords interface."""
@@ -6,6 +6,7 @@
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
+from lp.app.errors import IncompatibleArguments
from lp.buildmaster.enums import (
BuildFarmJobType,
BuildStatus,
@@ -20,10 +21,7 @@
from lp.services.database.interfaces import IStore
from lp.soyuz.enums import ArchivePurpose
from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuild
-from lp.soyuz.interfaces.buildrecords import (
- IHasBuildRecords,
- IncompatibleArguments,
- )
+from lp.soyuz.interfaces.buildrecords import IHasBuildRecords
from lp.soyuz.model.publishing import SourcePackagePublishingHistory
from lp.soyuz.tests.test_binarypackagebuild import BaseTestCaseWithThreeBuilds
from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
Follow ups