# HG changeset patch # User Thierry Florac # Date 1465987331 -7200 # Node ID 5026082a5aa149be21d8969f6d3f910d6df69df2 # Parent 6302ba59d8eab2d859bff18200d191e230d1374d Get site root from request diff -r 6302ba59d8ea -r 5026082a5aa1 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)))