def add(self, task): if not self._followed: transaction = self._manager.get() transaction.join(self) transaction.addBeforeCommitHook(self.beforeCommit) self._followed = True self._tasks[task.__class__.__name__] = task
def _follow(self): if not self._followed: service = queryUtility(interfaces.IMessageService) if service is None: return transaction = self.transaction_manager.get() transaction.join(self) transaction.addBeforeCommitHook(service.send_pending_messages) self._followed = True
def newTransaction(self, transaction): self.state = 'new' self.sp = self.conn.begin_nested() self.state = 'begun' transaction.addBeforeCommitHook(self._registerCommit)
def newTransaction(self, transaction): self.state = 'new' self.sp = self.connection.begin_nested() self.state = 'begun' transaction.addBeforeCommitHook(self._registerCommit)