def powerupsFor(self, interface): """ Returns powerups installed using C{powerUp}, in order of descending priority. Powerups found to have been deleted, either during the course of this powerupsFor iteration, during an upgrader, or previously, will not be returned. """ inMemoryPowerup = self._inMemoryPowerups.get(interface, None) if inMemoryPowerup is not None: yield inMemoryPowerup name = unicode(qual(interface), 'ascii') for cable in self.store.query( _PowerupConnector, AND(_PowerupConnector.interface == name, _PowerupConnector.item == self), sort=_PowerupConnector.priority.descending): pup = cable.powerup if pup is None: # this powerup was probably deleted during an upgrader. cable.deleteFromStore() else: indirector = IPowerupIndirector(pup, None) if indirector is not None: yield indirector.indirect(interface) else: yield pup
def powerupsFor(self, interface, tables=(), comparison=None): """ Returns powerups installed using C{powerUp}, in order of descending priority. Powerups found to have been deleted, either during the course of this powerupsFor iteration, during an upgrader, or previously, will not be returned. """ inMemoryPowerup = self._inMemoryPowerups.get(interface, []) for pup in inMemoryPowerup: yield pup if self.store is None: return name = qual(interface) tables = (_PowerupConnector, ) + tables if comparison: comparison = AND(_PowerupConnector.interface == name, _PowerupConnector.item == self, _PowerupConnector.powerup == tables[1].storeID, comparison) else: comparison = AND( _PowerupConnector.interface == name, _PowerupConnector.item == self, ) q = self.store.query( tables, comparison, sort=_PowerupConnector.priority.descending).distinct() for entries in q: cable = entries[0] pup = cable.powerup if pup is None: # this powerup was probably deleted during an upgrader. cable.deleteFromStore() else: indirector = IPowerupIndirector(pup, None) if indirector is not None: yield indirector.indirect(interface) else: yield pup
def powerupsFor(self, interface, tables=(), comparison=None): """ Returns powerups installed using C{powerUp}, in order of descending priority. Powerups found to have been deleted, either during the course of this powerupsFor iteration, during an upgrader, or previously, will not be returned. """ inMemoryPowerup = self._inMemoryPowerups.get(interface, []) for pup in inMemoryPowerup: yield pup if self.store is None: return name = qual(interface) tables = (_PowerupConnector,) + tables if comparison: comparison = AND( _PowerupConnector.interface == name, _PowerupConnector.item == self, _PowerupConnector.powerup == tables[1].storeID, comparison, ) else: comparison = AND(_PowerupConnector.interface == name, _PowerupConnector.item == self) q = self.store.query(tables, comparison, sort=_PowerupConnector.priority.descending).distinct() for entries in q: cable = entries[0] pup = cable.powerup if pup is None: # this powerup was probably deleted during an upgrader. cable.deleteFromStore() else: indirector = IPowerupIndirector(pup, None) if indirector is not None: yield indirector.indirect(interface) else: yield pup