Moved site manager dashboard header adapter to 'common' sub-module for all shared sites
authorThierry Florac <thierry.florac@onf.fr>
Wed, 15 Nov 2017 17:29:30 +0100
changeset 280 a87f40e0f10c
parent 279 c31da1985a3b
child 281 e5bfd8db9f3f
Moved site manager dashboard header adapter to 'common' sub-module for all shared sites
src/pyams_content/shared/common/zmi/site.py
src/pyams_content/shared/site/zmi/manager.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/common/zmi/site.py	Wed Nov 15 17:29:30 2017 +0100
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from pyams_content.shared.common.interfaces import ISharedSite
+from pyams_content.shared.common.interfaces.zmi import IDashboardSearchHeader
+from pyams_i18n.interfaces import II18n
+from pyams_zmi.layer import IAdminLayer
+
+# import packages
+from pyams_content.shared.common.zmi.dashboard import SharedToolDashboardView
+from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter
+
+from pyams_content import _
+
+
+@adapter_config(context=(ISharedSite, IAdminLayer, SharedToolDashboardView), provides=IDashboardSearchHeader)
+class SharedSiteDashboardSearchHeaderAdapter(ContextRequestViewAdapter):
+    """Site manager dashboard search header adapter"""
+
+    @property
+    def title(self):
+        translate = self.request.localizer.translate
+        return translate(_("SEARCH - Between all contents published into &laquo;&nbsp;{site}&nbsp;&raquo;")).format(
+            site=II18n(self.context).query_attribute('title', request=self.request)
+        )
--- a/src/pyams_content/shared/site/zmi/manager.py	Wed Nov 15 17:25:47 2017 +0100
+++ b/src/pyams_content/shared/site/zmi/manager.py	Wed Nov 15 17:29:30 2017 +0100
@@ -9,8 +9,6 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
-from pyams_content.shared.common.interfaces.zmi import IDashboardSearchHeader
-from pyams_content.shared.common.zmi.dashboard import SharedToolDashboardView
 
 __docformat__ = 'restructuredtext'
 
@@ -36,7 +34,7 @@
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.table import DefaultElementEditorAdapter
 from pyams_skin.viewlet.toolbar import ToolbarMenuItem
-from pyams_utils.adapter import adapter_config, ContextRequestAdapter, ContextRequestViewAdapter
+from pyams_utils.adapter import adapter_config, ContextRequestAdapter
 from pyams_utils.registry import query_utility
 from pyams_utils.unicode import translate_string
 from pyams_utils.url import absolute_url
@@ -127,15 +125,3 @@
 
     view_name = 'admin'
     modal_target = False
-
-
-@adapter_config(context=(ISiteManager, IAdminLayer, SharedToolDashboardView), provides=IDashboardSearchHeader)
-class SiteManagerDashboardSearchHeaderAdapter(ContextRequestViewAdapter):
-    """Site manager dashboard search header adapter"""
-
-    @property
-    def title(self):
-        translate = self.request.localizer.translate
-        return translate(_("SEARCH - Between all contents published into &laquo;&nbsp;{site}&nbsp;&raquo;")).format(
-            site=II18n(self.context).query_attribute('title', request=self.request)
-        )