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 attach( self, transaction ): zope_tpc = observer.getDataManager() if zope_tpc is not None: return dm = AlchemyDataManager() transaction.join( dm ) from engine import iter_engines # attach extant engines #print "observer attach" map( dm.transaction.get_or_add, iter_engines() )
def _is_activated(self): if self._activated is None: settings = self._get_settings() if settings is None: return False self._activated = bool(settings.activated) if self._activated: transaction = self.manager.get() transaction.join(self) return bool(self._activated)
def _follow(self): if not self._followed: transaction = self.transaction_manager.get() transaction.join(self) if self._active: self._get_id = getUtility(IIntIds).register # We could get the interfaces after configuration and # cache them forever self._interfaces = get_interfaces() self._followed = True
def join_transaction(self): transaction = self.transaction_manager.get() marker = getattr(transaction, '_dolmen_sunburnt_deindex', False) if not marker: # here we make the assumption that transaction is not shared # between threads setattr(transaction, '_dolmen_sunburnt_deindex', True) # register on transaction hook transaction.join(self) assert self.clean, ( "Inconsistent state I register to new transaction " + "but already got things to undo")
def _join(self): if not self._activated: transaction = self.manager.get() transaction.join(self) self._activated = True
def _join_txn(self): if self._needs_to_join: transaction = self.transaction_manager.get() transaction.join(self) self._needs_to_join = False self._begin(transaction)