--- a/src/pyams_thesaurus/term.py Tue Sep 18 16:27:26 2018 +0200
+++ b/src/pyams_thesaurus/term.py Tue Nov 27 17:21:15 2018 +0100
@@ -12,32 +12,28 @@
__docformat__ = 'restructuredtext'
-
-# import standard library
from datetime import datetime
-# import interfaces
-from pyams_thesaurus.interfaces.extension import IThesaurusTermExtension
-from pyams_thesaurus.interfaces.term import STATUS_PUBLISHED, IThesaurusTerm, IThesaurusTermsContainer, \
- IThesaurusLoaderTerm
-from pyams_thesaurus.interfaces.thesaurus import IThesaurus, IThesaurusExtract
-from pyams_utils.interfaces.tree import INode
-from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectRemovedEvent, IObjectModifiedEvent, \
- IObjectMovedEvent
+from persistent import Persistent
+from pyramid.events import subscriber
+from zope.container.contained import Contained
+from zope.interface import alsoProvides, implementer, noLongerProvides
+from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectMovedEvent, \
+ IObjectRemovedEvent
+from zope.schema.fieldproperty import FieldProperty
from zope.traversing.interfaces import ITraversable
-# import packages
-from persistent import Persistent
-from pyams_catalog.utils import index_object, unindex_object, reindex_object
-from pyams_utils.adapter import adapter_config, ContextAdapter
+from pyams_catalog.utils import index_object, reindex_object, unindex_object
+from pyams_thesaurus.interfaces.extension import IThesaurusTermExtension
+from pyams_thesaurus.interfaces.term import IThesaurusLoaderTerm, IThesaurusTerm, IThesaurusTermsContainer, \
+ STATUS_PUBLISHED
+from pyams_thesaurus.interfaces.thesaurus import IThesaurus, IThesaurusExtract
+from pyams_utils.adapter import ContextAdapter, adapter_config
+from pyams_utils.interfaces.tree import INode
from pyams_utils.registry import query_utility
from pyams_utils.timezone import tztime
from pyams_utils.traversing import get_parent
from pyams_utils.unicode import translate_string
-from pyramid.events import subscriber
-from zope.container.contained import Contained
-from zope.interface import implementer, alsoProvides, noLongerProvides
-from zope.schema.fieldproperty import FieldProperty
REVERSE_LINK_ATTRIBUTES = {'generic': 'specifics',
@@ -232,8 +228,9 @@
self._extensions = new_value
def query_extensions(self):
- return [util for util in [query_utility(IThesaurusTermExtension, ext) for ext in self.extensions]
- if util is not None]
+ return sorted([util for util in [query_utility(IThesaurusTermExtension, ext) for ext in self.extensions]
+ if util is not None],
+ key=lambda x: getattr(x, 'weight', 999))
@property
def created(self):