def __setslice__ (self, i, j, collection):
        """L.__setslice__ (i, j, collection) -> L[i:j] = collection

        Raises a TypeError, if the passed collection argument does not
        inherit from the ListItemCollection class.
        """
        if not isinstance (collection, ListItemCollection):
            raise TypeError ("collection must inherit from ListItemCollection")

        old = UserList.__getslice__ (self, i, j)
        UserList.__setslice__ (self, i, j, collection[:])
        new = UserList.__getslice__ (self, i, j)
        
        # Clean up the old ones.
        for item in old:
            item.collection = None
            self._length -= 1
            del item

        # Set the relations for the new ones.
        for item in new:
            item.collection = self
            self._length += 1
        if self.list_changed:
            self.list_changed (self)
Example #2
0
    def __setslice__(self, i, j, collection):
        """L.__setslice__ (i, j, collection) -> L[i:j] = collection

        Raises a TypeError, if the passed collection argument does not
        inherit from the ListItemCollection class.
        """
        if not isinstance(collection, ListItemCollection):
            raise TypeError("collection must inherit from ListItemCollection")

        old = UserList.__getslice__(self, i, j)
        UserList.__setslice__(self, i, j, collection[:])
        new = UserList.__getslice__(self, i, j)

        # Clean up the old ones.
        for item in old:
            item.collection = None
            self._length -= 1
            del item

        # Set the relations for the new ones.
        for item in new:
            item.collection = self
            self._length += 1
        if self.list_changed:
            self.list_changed(self)
 def __setslice__(self, i, j, seq):
     old = list.__getslice__(self, i, j)
     for f in old:
         self.__unregister_field(f)
     for f in seq:
         self.__register_field(f)
     list.__setslice__(self, i, j, seq)
 def __setslice__(self, i, j, seq):
     old=list.__getslice__(self, i, j)
     for f in old:
         self.__unregister_field(f)
     for f in seq:
         self.__register_field(f)
     list.__setslice__(self, i, j, seq)
Example #5
0
 def __getslice__(self, i, j):
     self.__make_unique()
     return UserList.__getslice__(self, i, j)
Example #6
0
 def __getslice__(self, i, j):
     self.__make_unique()
     return UserList.__getslice__(self, i, j)
 def __getslice__(self, i, j):
     x = list.__getslice__(self, i, j)
     return self.__class__(x, self.fieldmapper, self.storelists)
Example #8
0
 def __getslice__(self, i, j):
     return UserList.__getslice__(self, i, j)
 def __getslice__(self, i, j):
     x=list.__getslice__(self, i, j)
     return self.__class__(x, self.fieldmapper, self.storelists)
Example #10
0
 def __getslice__(self, i, j):
    return  UserList.__getslice__(self, i, j)