equal
deleted
inserted
replaced
34 from zope.componentvocabulary.vocabulary import UtilityVocabulary |
34 from zope.componentvocabulary.vocabulary import UtilityVocabulary |
35 from zope.container.contained import Contained |
35 from zope.container.contained import Contained |
36 from zope.interface import implementer, implements, classProvides |
36 from zope.interface import implementer, implements, classProvides |
37 from zope.schema import getFieldNames |
37 from zope.schema import getFieldNames |
38 from zope.schema.fieldproperty import FieldProperty |
38 from zope.schema.fieldproperty import FieldProperty |
|
39 from zope.security.proxy import removeSecurityProxy |
|
40 |
39 |
41 |
40 # import local packages |
42 # import local packages |
41 |
43 |
42 |
44 |
43 class ZEOConnectionInfo(object): |
45 class ZEOConnectionInfo(object): |
120 # IPersistent adapters copied from zc.twist package |
122 # IPersistent adapters copied from zc.twist package |
121 # also register this for adapting from IConnection |
123 # also register this for adapting from IConnection |
122 @adapter(IPersistent) |
124 @adapter(IPersistent) |
123 @implementer(ITransactionManager) |
125 @implementer(ITransactionManager) |
124 def transactionManager(obj): |
126 def transactionManager(obj): |
125 conn = IConnection(obj) # typically this will be |
127 conn = IConnection(removeSecurityProxy(obj)) # typically this will be |
126 # zope.app.keyreference.persistent.connectionOfPersistent |
128 # zope.app.keyreference.persistent.connectionOfPersistent |
127 try: |
129 try: |
128 return conn.transaction_manager |
130 return conn.transaction_manager |
129 except AttributeError: |
131 except AttributeError: |
130 return conn._txn_mgr |
132 return conn._txn_mgr |
131 # or else we give up; who knows. transaction_manager is the more |
133 # or else we give up; who knows. transaction_manager is the more |