Get site root from request
authorThierry Florac <thierry.florac@onf.fr>
Wed, 15 Jun 2016 12:42:11 +0200
changeset 69 5026082a5aa1
parent 68 6302ba59d8ea
child 70 67686624b3cf
Get site root from request
src/pyams_security/profile.py
--- a/src/pyams_security/profile.py	Wed Jun 15 12:41:52 2016 +0200
+++ b/src/pyams_security/profile.py	Wed Jun 15 12:42:11 2016 +0200
@@ -19,7 +19,6 @@
 from pyams_security.interfaces import IPrincipalInfo
 from pyams_security.interfaces.profile import PUBLIC_PROFILE_KEY, IPublicProfile
 from pyams_utils.interfaces import PUBLIC_PERMISSION
-from pyams_utils.interfaces.site import ISiteRoot
 from pyams_utils.interfaces.tales import ITALESExtension
 from zope.annotation.interfaces import IAnnotations, IAttributeAnnotatable
 from zope.intid.interfaces import IIntIds
@@ -31,7 +30,6 @@
 from pyams_utils.adapter import adapter_config, ContextRequestAdapter
 from pyams_utils.registry import get_utility
 from pyams_utils.request import check_request, query_request
-from pyams_utils.traversing import get_parent
 from pyramid.security import Allow, ALL_PERMISSIONS, Everyone
 from pyramid.threadlocal import get_current_registry, get_current_request
 from zope.container.contained import Contained
@@ -71,7 +69,7 @@
         get_current_registry().notify(ObjectCreatedEvent(profile))
         request = get_current_request()
         if request is not None:
-            root = get_parent(request.context, ISiteRoot)
+            root = request.root
             intids = get_utility(IIntIds)
             locate(profile, root)  # avoid NotYet exception
             locate(profile, root, '++profile++{0}'.format(intids.register(profile)))