Imports cleanup
authorThierry Florac <thierry.florac@onf.fr>
Tue, 17 Jul 2018 18:01:26 +0200
changeset 855 b83aca9d6e2b
parent 854 d9c216572b6b
child 856 0e8c775ca958
Imports cleanup
src/pyams_content/shared/common/types.py
--- a/src/pyams_content/shared/common/types.py	Tue Jul 17 17:59:54 2018 +0200
+++ b/src/pyams_content/shared/common/types.py	Tue Jul 17 18:01:26 2018 +0200
@@ -9,9 +9,6 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
-from pyams_content.shared.common.interfaces import ISharedContentFactory
-from pyams_utils.interfaces import ICacheKeyValue
-from pyams_utils.registry import get_local_registry
 
 __docformat__ = 'restructuredtext'
 
@@ -24,6 +21,7 @@
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget
 from pyams_content.component.theme.interfaces import IThemesTarget, IThemesInfo
 from pyams_content.interfaces import MANAGE_TOOL_PERMISSION
+from pyams_content.shared.common.interfaces import ISharedContentFactory
 from pyams_content.shared.common.interfaces.types import IDataType, ISubType, IBaseDataType, ITypedSharedTool, \
     ITypedDataManager, DATA_MANAGER_ANNOTATION_KEY, DATA_TYPES_VOCABULARY, DATA_TYPE_FIELDS_VOCABULARY, \
     IWfTypedSharedContent, DATA_SUBTYPES_VOCABULARY, ALL_DATA_TYPES_VOCABULARY
@@ -38,6 +36,7 @@
 from pyams_content.shared.common import WfSharedContent, IWfSharedContentFactory
 from pyams_content.shared.common.manager import SharedTool
 from pyams_utils.adapter import adapter_config, ContextAdapter, get_annotation_adapter
+from pyams_utils.registry import get_local_registry
 from pyams_utils.request import check_request
 from pyams_utils.traversing import get_parent
 from pyams_utils.vocabulary import vocabulary_config
@@ -168,17 +167,17 @@
 
 
 def get_all_data_types(request):
-    """Get list of all registered data types"""
+    """Get list of all registered data types as JSON object"""
     results = []
     registry = get_local_registry()
     for tool in sorted(registry.getAllUtilitiesRegisteredFor(ITypedSharedTool),
                        key=lambda x: II18n(x).query_attribute('title', request=request)):
-        content_factory = IWfSharedContentFactory(ISharedContentFactory(tool))
         manager = ITypedDataManager(tool)
         terms = [{
             'id': datatype.__name__,
             'text': II18n(datatype).query_attribute('label', request=request)
         } for datatype in manager.values()]
+        content_factory = IWfSharedContentFactory(ISharedContentFactory(tool))
         results.append({
             'text': request.localizer.translate(content_factory.content_name),
             'disabled': True,