Added search folder canonical URL adapter
authorThierry Florac <tflorac@ulthar.net>
Wed, 23 Jan 2019 18:46:33 +0100
changeset 395 54d4b7b7c996
parent 394 2f22f3bb6181
child 396 fcc70be2fc80
Added search folder canonical URL adapter
src/pyams_default_theme/features/search/__init__.py
--- a/src/pyams_default_theme/features/search/__init__.py	Wed Jan 23 18:36:54 2019 +0100
+++ b/src/pyams_default_theme/features/search/__init__.py	Wed Jan 23 18:46:33 2019 +0100
@@ -14,17 +14,24 @@
 
 from pyams_content.features.search.interfaces import ISearchFolder
 from pyams_content.shared.site import ISiteElementNavigation
+from pyams_default_theme import _
 from pyams_default_theme.interfaces import IContentSummaryInfo
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IBreadcrumbItem
 from pyams_skin.layer import IPyAMSUserLayer
 from pyams_skin.viewlet.breadcrumb import BreadcrumbItem
 from pyams_utils.adapter import ContextRequestAdapter, adapter_config
-from pyams_utils.interfaces.url import IRelativeURL
+from pyams_utils.interfaces.url import ICanonicalURL, IRelativeURL
 from pyams_utils.url import absolute_url
 from pyams_workflow.interfaces import IWorkflowPublicationInfo
 
-from pyams_default_theme import _
+
+@adapter_config(context=(ISearchFolder, IPyAMSUserLayer), provides=ICanonicalURL)
+class SearchFolderCanonicalUrlAdapter(ContextRequestAdapter):
+    """Search folder canonical URL adapter"""
+
+    def get_url(self, display_context=None, view_name=None, query=None):
+        return absolute_url(self.context, self.request, view_name, query)
 
 
 @adapter_config(context=(ISearchFolder, IPyAMSUserLayer), provides=IRelativeURL)