Get site root from request
authorThierry Florac <thierry.florac@onf.fr>
Wed, 15 Jun 2016 12:26:42 +0200
changeset 143 60f49532b262
parent 142 5e603a22d753
child 144 3198f3bcf67d
Get site root from request
src/pyams_skin/site.py
--- a/src/pyams_skin/site.py	Wed Jun 15 12:25:28 2016 +0200
+++ b/src/pyams_skin/site.py	Wed Jun 15 12:26:42 2016 +0200
@@ -19,11 +19,9 @@
 from pyams_skin.interfaces import IContextTitlePrefix
 from pyams_skin.interfaces.configuration import IBackOfficeConfiguration
 from pyams_skin.layer import IPyAMSLayer
-from pyams_utils.interfaces.site import ISiteRoot
 
 # import packages
 from pyams_utils.adapter import adapter_config, ContextRequestAdapter
-from pyams_utils.traversing import get_parent
 from zope.interface import Interface
 
 
@@ -33,8 +31,6 @@
 
     @property
     def prefix(self):
-        root = get_parent(self.context, ISiteRoot)
-        if root is not None:
-            configuration = IBackOfficeConfiguration(root, None)
-            if configuration is not None:
-                return configuration.short_title
+        configuration = IBackOfficeConfiguration(self.request.root, None)
+        if configuration is not None:
+            return configuration.short_title