# HG changeset patch # User Thierry Florac # Date 1569397668 -7200 # Node ID 1bbc829453f9ce90de78c1fd91b3f23866004c18 # Parent 4aca0ad81b2b494ada5c6bc738054ff1026dc579 Formatting... diff -r 4aca0ad81b2b -r 1bbc829453f9 src/pyams_content/component/association/container.py --- a/src/pyams_content/component/association/container.py Tue Sep 17 16:11:08 2019 +0200 +++ b/src/pyams_content/component/association/container.py Wed Sep 25 09:47:48 2019 +0200 @@ -10,8 +10,6 @@ # FOR A PARTICULAR PURPOSE. # -__docformat__ = 'restructuredtext' - from zope.container.ordered import OrderedContainer from zope.location import locate from zope.location.interfaces import ISublocations @@ -19,8 +17,8 @@ from zope.traversing.interfaces import ITraversable from pyams_catalog.utils import index_object -from pyams_content.component.association.interfaces import ASSOCIATION_CONTAINER_KEY, IAssociationContainer, \ - IAssociationContainerTarget, IAssociationInfo, IAssociationItem +from pyams_content.component.association.interfaces import ASSOCIATION_CONTAINER_KEY, \ + IAssociationContainer, IAssociationContainerTarget, IAssociationInfo, IAssociationItem from pyams_content.features.checker import BaseContentChecker from pyams_content.features.checker.interfaces import IContentChecker from pyams_utils.adapter import ContextAdapter, adapter_config, get_annotation_adapter @@ -30,6 +28,9 @@ from pyams_utils.vocabulary import vocabulary_config from pyams_zmi.layer import IAdminLayer + +__docformat__ = 'restructuredtext' + from pyams_content import _ @@ -59,7 +60,8 @@ @adapter_config(context=IAssociationContainerTarget, provides=IAssociationContainer) def association_container_factory(target): """Associations container factory""" - return get_annotation_adapter(target, ASSOCIATION_CONTAINER_KEY, IAssociationContainer, name='++ass++') + return get_annotation_adapter(target, ASSOCIATION_CONTAINER_KEY, IAssociationContainer, + name='++ass++') @adapter_config(name='ass', context=IAssociationContainerTarget, provides=ITraversable) @@ -94,7 +96,7 @@ if not association.visible: continue info = IAssociationInfo(association) - for name, checker in sorted(registry.getAdapters((association, ), IContentChecker), + for name, checker in sorted(registry.getAdapters((association,), IContentChecker), key=lambda x: x[1].weight): output.append('- {0} :'.format(info.user_title or '({0})'.format(info.inner_title)))