# HG changeset patch # User Thierry Florac # Date 1432117855 -7200 # Node ID 51a07039228f2423ab2aefb8274c38606d1474ea # Parent cadf156a926e34ae948b426644f15b7923f44f96 Changed registry access diff -r cadf156a926e -r 51a07039228f src/pyams_security/security.py --- a/src/pyams_security/security.py Wed May 20 12:30:17 2015 +0200 +++ b/src/pyams_security/security.py Wed May 20 12:30:55 2015 +0200 @@ -30,6 +30,8 @@ from pyams_utils.request import check_request from pyramid.location import lineage from pyramid.security import DENY_ALL, Everyone, Allow, ALL_PERMISSIONS, Authenticated +from pyramid.threadlocal import get_current_registry +from zope.container.contained import Contained from zope.interface import implementer from zope.lifecycleevent import ObjectCreatedEvent from zope.location.location import locate @@ -37,7 +39,7 @@ @implementer(IRoleProtectedObject) -class RoleProtectedObject(Persistent): +class RoleProtectedObject(Persistent, Contained): """Base class for object protected by roles""" inherit_parent_security = FieldProperty(IRoleProtectedObject['inherit_parent_security']) @@ -176,7 +178,7 @@ protection = annotations.get(ROLES_ANNOTATIONS_KEY) if protection is None: protection = annotations[ROLES_ANNOTATIONS_KEY] = RoleProtectedObject() - check_request().registry.notify(ObjectCreatedEvent(protection)) + get_current_registry().notify(ObjectCreatedEvent(protection)) locate(protection, context) return protection