mixins.py
branchstable
changeset 6011 b5f15098f282
parent 5895 6a3f776292a5
child 6515 6e998b1be7fd
equal deleted inserted replaced
6010:9d40ee3d0551 6011:b5f15098f282
    69     def iterchildren(self, _done=None):
    69     def iterchildren(self, _done=None):
    70         if _done is None:
    70         if _done is None:
    71             _done = set()
    71             _done = set()
    72         for child in self.children():
    72         for child in self.children():
    73             if child.eid in _done:
    73             if child.eid in _done:
    74                 self.error('loop in %s tree', self.__regid__.lower())
    74                 self.error('loop in %s tree: %s', self.__regid__.lower(), child)
    75                 continue
    75                 continue
    76             yield child
    76             yield child
    77             _done.add(child.eid)
    77             _done.add(child.eid)
    78 
    78 
    79     def prefixiter(self, _done=None):
    79     def prefixiter(self, _done=None):
    92         """returns the list of eids from the root object to this object"""
    92         """returns the list of eids from the root object to this object"""
    93         path = []
    93         path = []
    94         parent = self
    94         parent = self
    95         while parent:
    95         while parent:
    96             if parent.eid in path:
    96             if parent.eid in path:
    97                 self.error('loop in %s tree', self.__regid__.lower())
    97                 self.error('loop in %s tree: %s', self.__regid__.lower(), parent)
    98                 break
    98                 break
    99             path.append(parent.eid)
    99             path.append(parent.eid)
   100             try:
   100             try:
   101                 # check we are not leaving the tree
   101                 # check we are not leaving the tree
   102                 if (parent.tree_attribute != self.tree_attribute or
   102                 if (parent.tree_attribute != self.tree_attribute or