示例#1
0
    def insert(self, thing):
        """Insert the given Enity or Driver into this Entity.

        Such that:

        >>> A.insert(B)
        >>> (B in A)
        True

        A given entity can only be in a Pool one time.
        """

        d = self.ensure_driver(
            thing, "Can only insert an Entity or a Driver. "
            "Tried to insert %s." % str(type(thing)))

        if d in self:
            raise PoolException("%s is already in pool %s." % (d, self))

        if d.parents(clusto_drivers=[ExclusivePool]):
            raise PoolException("%s is in ExclusivePool %s" % (d, self))

        self.add_attr("_contains", d, number=True)
示例#2
0
    def insert(self, thing):
        """Insert the given Enity or Driver into this Entity.

        Such that:

        >>> A.insert(B)
        >>> (B in A)
        True

        A given entity can only be in ONE UniquePool.
        """

        pools = thing.parents(clusto_drivers=[self._driver_name])
        if pools:
            raise PoolException("%s is already in UniquePool(s) %s." %
                                (thing, pools))

        Pool.insert(self, thing)
示例#3
0
    def insert(self, thing):
        """Insert the given Enity or Driver into this Entity.

        Such that:

        >>> A.insert(B)
        >>> (B in A)
        True

        A given entity can only be inserted into an ExclusivePool if
        it is in NO other pools.
        """

        pools = Pool.get_pools(thing)
        if pools:
            raise PoolException("%s is already in pools %s, cannot insert "
                                "exclusively." % (thing, pools))

        Pool.insert(self, thing)