Remove security proxy in ITransactionManager adapter ZTK-1.1
authorThierry Florac <thierry.florac@onf.fr>
Thu, 05 Dec 2013 11:58:08 +0100
branchZTK-1.1
changeset 242 ffa98c18e909
parent 241 56f99c783782
child 243 a5e0b9dad574
Remove security proxy in ITransactionManager adapter
src/ztfy/utils/zodb.py
--- a/src/ztfy/utils/zodb.py	Tue Dec 03 11:47:15 2013 +0100
+++ b/src/ztfy/utils/zodb.py	Thu Dec 05 11:58:08 2013 +0100
@@ -36,6 +36,8 @@
 from zope.interface import implementer, implements, classProvides
 from zope.schema import getFieldNames
 from zope.schema.fieldproperty import FieldProperty
+from zope.security.proxy import removeSecurityProxy
+
 
 # import local packages
 
@@ -122,8 +124,8 @@
 @adapter(IPersistent)
 @implementer(ITransactionManager)
 def transactionManager(obj):
-    conn = IConnection(obj) # typically this will be
-                            # zope.app.keyreference.persistent.connectionOfPersistent
+    conn = IConnection(removeSecurityProxy(obj))  # typically this will be
+                                                  # zope.app.keyreference.persistent.connectionOfPersistent
     try:
         return conn.transaction_manager
     except AttributeError: