Changeset 3029

Show
Ignore:
Timestamp:
04/04/07 17:14:16 (2 years ago)
Author:
ed
Message:

This should fix the problem with getChangedRows() returning every row number when any child had a single change.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/biz/dBizobj.py

    r3028 r3029  
    923923 
    924924 
    925     def isAnyChanged(self, _topLevel=True): 
     925    def isAnyChanged(self, parentPK=None): 
    926926        """Returns True if any record in the current record set has been changed.""" 
    927         try: 
    928             cc = self._CurrentCursor 
    929         except: 
    930             cc = None 
     927        if parentPK is None: 
     928            try: 
     929                cc = self._CurrentCursor 
     930            except: 
     931                cc = None 
     932        else: 
     933            cc = self.__cursors.get(parentPK, None) 
    931934        if cc is None: 
    932935            # No cursor, no changes. 
    933936            return False 
    934         if _topLevel: 
    935             # Only check the _CurrentCursor: 
    936             if self._CurrentCursor.isChanged(allRows=True): 
    937                 return True 
    938         else: 
    939             # Need to check all cached cursors: 
    940             for cursor in self.__cursors.values(): 
    941                 if cursor.isChanged(allRows=True): 
    942                     return True 
     937         
     938        if cc.isChanged(allRows=True): 
     939            return True 
    943940     
    944941        # Nothing's changed in the top level, so we need to recurse the children: 
     942        try: 
     943            pk = self.getPK() 
     944        except dException.NoRecordsException: 
     945            # If there are no records, there can be no changes 
     946            return False 
     947             
    945948        for child in self.__children: 
    946             if child.isAnyChanged(_topLevel=False): 
     949            if child.isAnyChanged(parentPK=pk): 
    947950                return True 
    948          
     951        # If we made it to here, there are no changes. 
    949952        return False 
    950953 
     
    967970        if not ret: 
    968971            # see if any child bizobjs have changed 
     972            try: 
     973                pk = self.getPK() 
     974            except dException.NoRecordsException: 
     975                # If there are no records, there can be no changes 
     976                return False 
    969977            for child in self.__children: 
    970                 ret = child.isAnyChanged(_topLevel=False
     978                ret = child.isAnyChanged(parentPK=pk
    971979                if ret: 
    972980                    break