launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29154
[Merge] ~cjwatson/launchpad:interface-ordering into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:interface-ordering into launchpad:master.
Commit message:
Apply consistent ordering of interface declarations
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/429634
Under `ZOPE_INTERFACE_STRICT_IRO=1`, zope.interface is strict about ensuring that it can compute a C3 resolution order for interfaces, which gives more predictable behaviour in some edge cases (see https://zopeinterface.readthedocs.io/en/latest/api/ro.html). This means that some previously-valid declaration orders for the interfaces implemented by a class are now rejected. In particular, having an interface inherit from some parent interfaces and then having classes that declare that they implement those interfaces in a different order is a problem under strict IRO enforcement.
There were a few places where the ordering of multiple implemented interfaces was incoherent, or where the ordering of mixins that themselves implement some interfaces didn't match the order of interfaces inherited by the list of explicitly-implemented interfaces, resulting in some extremely confusing error messages under strict IRO enforcement. This cleans most of those up. There should be no functional change from this commit when strict IRO enforcement is disabled (the current default).
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:interface-ordering into launchpad:master.
diff --git a/lib/lp/blueprints/interfaces/specification.py b/lib/lp/blueprints/interfaces/specification.py
index 0f56e6e..2443c8c 100644
--- a/lib/lp/blueprints/interfaces/specification.py
+++ b/lib/lp/blueprints/interfaces/specification.py
@@ -37,7 +37,7 @@ from zope.schema import Bool, Choice, Datetime, Int, List, Text, TextLine
from lp import _
from lp.app.enums import InformationType
-from lp.app.interfaces.launchpad import IPrivacy
+from lp.app.interfaces.informationtype import IInformationType
from lp.app.validators import LaunchpadValidationError
from lp.app.validators.url import valid_webref
from lp.blueprints.enums import (
@@ -151,7 +151,7 @@ class SpecURLField(TextLine):
)
-class ISpecificationPublic(IPrivacy):
+class ISpecificationPublic(IInformationType):
"""Specification's public attributes and methods."""
id = Int(title=_("Database ID"), required=True, readonly=True)
diff --git a/lib/lp/blueprints/model/specification.py b/lib/lp/blueprints/model/specification.py
index cffe3d2..2c27cfa 100644
--- a/lib/lp/blueprints/model/specification.py
+++ b/lib/lp/blueprints/model/specification.py
@@ -39,7 +39,6 @@ from lp.app.enums import (
InformationType,
)
from lp.app.errors import UserCannotUnsubscribePerson
-from lp.app.interfaces.informationtype import IInformationType
from lp.app.interfaces.services import IService
from lp.app.model.launchpad import InformationTypeMixin
from lp.blueprints.adapters import SpecificationDelta
@@ -164,7 +163,7 @@ SPECIFICATION_POLICY_DEFAULT_TYPES = {
}
-@implementer(ISpecification, IBugLinkTarget, IInformationType)
+@implementer(ISpecification, IBugLinkTarget)
class Specification(StormBase, BugLinkTargetMixin, InformationTypeMixin):
"""See ISpecification."""
diff --git a/lib/lp/registry/model/distroseries.py b/lib/lp/registry/model/distroseries.py
index 84f3b74..7844249 100644
--- a/lib/lp/registry/model/distroseries.py
+++ b/lib/lp/registry/model/distroseries.py
@@ -153,21 +153,21 @@ DEFAULT_INDEX_COMPRESSORS = [
]
+@delegate_to(ISpecificationTarget, context="distribution")
@implementer(
IBugSummaryDimension,
IDistroSeries,
IHasQueueItems,
ISeriesBugTarget,
)
-@delegate_to(ISpecificationTarget, context="distribution")
class DistroSeries(
SQLBase,
+ SeriesMixin,
BugTargetBase,
HasSpecificationsMixin,
+ HasMilestonesMixin,
HasTranslationImportsMixin,
HasTranslationTemplatesMixin,
- HasMilestonesMixin,
- SeriesMixin,
StructuralSubscriptionTargetMixin,
):
"""A particular series of a distribution."""
diff --git a/lib/lp/registry/model/product.py b/lib/lp/registry/model/product.py
index a875523..f905576 100644
--- a/lib/lp/registry/model/product.py
+++ b/lib/lp/registry/model/product.py
@@ -247,23 +247,23 @@ specification_policy_default = {
class Product(
SQLBase,
BugTargetBase,
- MakesAnnouncements,
HasDriversMixin,
- HasSpecificationsMixin,
- HasSprintsMixin,
- KarmaContextMixin,
- QuestionTargetMixin,
- HasTranslationImportsMixin,
- HasAliasMixin,
- StructuralSubscriptionTargetMixin,
- HasMilestonesMixin,
OfficialBugTagTargetMixin,
HasBranchesMixin,
- HasCustomLanguageCodesMixin,
HasMergeProposalsMixin,
+ HasMilestonesMixin,
+ HasSprintsMixin,
+ HasTranslationImportsMixin,
+ TranslationPolicyMixin,
+ KarmaContextMixin,
+ MakesAnnouncements,
HasCodeImportsMixin,
+ QuestionTargetMixin,
+ HasSpecificationsMixin,
+ StructuralSubscriptionTargetMixin,
InformationTypeMixin,
- TranslationPolicyMixin,
+ HasAliasMixin,
+ HasCustomLanguageCodesMixin,
SharingPolicyMixin,
):
"""A Product."""
diff --git a/lib/lp/registry/model/productseries.py b/lib/lp/registry/model/productseries.py
index dd76011..9574999 100644
--- a/lib/lp/registry/model/productseries.py
+++ b/lib/lp/registry/model/productseries.py
@@ -93,17 +93,17 @@ def landmark_key(landmark):
return date + landmark["name"]
-@implementer(IBugSummaryDimension, IProductSeries, ISeriesBugTarget)
@delegate_to(ISpecificationTarget, context="product")
+@implementer(IBugSummaryDimension, IProductSeries, ISeriesBugTarget)
class ProductSeries(
SQLBase,
+ SeriesMixin,
BugTargetBase,
HasMilestonesMixin,
HasSpecificationsMixin,
HasTranslationImportsMixin,
HasTranslationTemplatesMixin,
StructuralSubscriptionTargetMixin,
- SeriesMixin,
):
"""A series of product releases."""
diff --git a/lib/lp/services/webapp/publisher.py b/lib/lp/services/webapp/publisher.py
index 88e3d76..f58344d 100644
--- a/lib/lp/services/webapp/publisher.py
+++ b/lib/lp/services/webapp/publisher.py
@@ -561,7 +561,7 @@ class LaunchpadView(UserAttributeCache):
return beta_info
-@implementer(IXMLRPCView, IMethodPublisher)
+@implementer(IMethodPublisher, IXMLRPCView)
class LaunchpadXMLRPCView(UserAttributeCache):
"""Base class for writing XMLRPC view code."""