Added glossary to sitemap
authortflorac@dagon.home
Tue, 25 Dec 2018 16:04:59 +0100
changeset 302 85fd0b442e2a
parent 301 93875f62e559
child 303 cd6332149c8a
Added glossary to sitemap
src/pyams_default_theme/features/sitemap/__init__.py
--- a/src/pyams_default_theme/features/sitemap/__init__.py	Fri Dec 21 16:45:53 2018 +0100
+++ b/src/pyams_default_theme/features/sitemap/__init__.py	Tue Dec 25 16:04:59 2018 +0100
@@ -22,12 +22,14 @@
 from zope.intid import IIntIds
 
 from pyams_catalog.query import CatalogResultSet
+from pyams_content.component.theme import ITagsManager
 from pyams_content.root import ISiteRoot, ISiteRootToolsConfiguration
 from pyams_content.shared.common import CONTENT_TYPES, IBaseSharedTool
 from pyams_i18n.interfaces import II18nManager
 from pyams_skin.layer import IPyAMSUserLayer
+from pyams_thesaurus.interfaces.thesaurus import IThesaurus
 from pyams_utils.list import unique_iter
-from pyams_utils.registry import get_all_utilities_registered_for, get_utility
+from pyams_utils.registry import get_all_utilities_registered_for, get_utility, query_utility
 from pyams_workflow.interfaces import IWorkflow, IWorkflowPublicationInfo
 
 
@@ -72,6 +74,11 @@
             publication_info = IWorkflowPublicationInfo(tool, None)
             if (publication_info is None) or publication_info.is_visible(self.request):
                 yield timestamp, tool
+        tags_manager = ITagsManager(self.request.root)
+        if tags_manager.enable_glossary:
+            thesaurus = query_utility(IThesaurus, name=tags_manager.glossary_thesaurus_name)
+            if thesaurus is not None:
+                yield timestamp, thesaurus
 
 
 @view_config(name='sitemap.xml', context=IBaseSharedTool, request_type=IPyAMSUserLayer,