def _register(self): TM._register(self) # XXX Make sure we are called before the # persistent ExtFile object is destroyed. t = transaction.get() if hasattr(t, '_resources'): r = t._resources.pop() t._resources.insert(0, r)
def _register(self, activity_tool): if not self._registered: self.activity_tool = activity_tool self._activity_tool_path = activity_tool.getPhysicalPath() TM._register(self) self._prepare_args = 0, 0 if self._prepare_args: transaction.get().addBeforeCommitHook(self._prepare, self._prepare_args) self._prepare_args = None
def __init__(self, host, user, password, port=993): """ Instanciate a new IMAPS server and keep track of all parameters """ self.host = host self.user = user self.password = password self.port = port self.message_folder = _MARKER self.server = imaplib.IMAP4_SSL(self.host) # XXX What about port ? self.server.login(user, password) # What about failures ? response, message_count = self.server.select() # XXX response not taken into account # XXX What about failures ? TM._register(self) # Register transaction once everything is ready
def test_sortKey(self): tm = TM() # the default Transaction Manager should have .sortKey() of '1' for # backward compatibility. It must be a string according to the # ITransactionManager interface. self.assertEqual(tm.sortKey(), '1') # but the sortKey() should be adjustable tm.setSortKey('2') self.assertEqual(tm.sortKey(), '2') tm.setSortKey([]) self.assertEqual(tm.sortKey(), '[]')
def test_sortKey(self): tm = TM() # the default Transaction Manager should have .sortKey() of 1 for # backward compatibility self.assertEquals(tm.sortKey(), 1) # but the sortKey() should be adjustable tm.setSortKey(()) self.assertEquals(tm.sortKey(), ())
def tpc_vote(self, *ignored): # Raise if a disconnection is detected, to avoid detecting this later self._query("SELECT 1") return TM.tpc_vote(self, *ignored)
def _register(self, activity_tool): TM._register(self) if self.activity_tool is None: self.activity_tool = activity_tool transaction.get().addBeforeCommitHook(self._prepare)