Changeset 3070

Show
Ignore:
Timestamp:
04/19/07 13:57:31 (2 years ago)
Author:
ed
Message:

This fixes the problem with cancel() not seeing changed child bizobjs. I've also modified save() to use scanChangedRows() as does cancel(), rather than implement this code in multiple places.

Files:

Legend:

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

    r3068 r3070  
    263263            cursor.beginTransaction() 
    264264         
    265         changed_rows = self.getChangedRows() 
    266         for row in changed_rows: 
    267             self._moveToRowNum(row) 
    268             try: 
    269                 self.save(startTransaction=False, topLevel=False) 
    270             except dException.ConnectionLostException, e: 
    271                 self.RowNumber = current_row 
    272                 raise dException.ConnectionLostException, e 
    273             except dException.DBQueryException, e: 
    274                 # Something failed; reset things. 
    275                 if useTransact: 
    276                     cursor.rollbackTransaction() 
    277                 # Pass the exception to the UI 
    278                 self.RowNumber = current_row 
    279                 raise dException.DBQueryException, e 
    280             except dException.dException, e: 
    281                 if useTransact: 
    282                     cursor.rollbackTransaction() 
    283                 self.RowNumber = current_row 
    284                 raise 
     265        try: 
     266            self.scanChangedRows(self.save, startTransaction=False, topLevel=False) 
     267        except dException.ConnectionLostException, e: 
     268            self.RowNumber = current_row 
     269            raise dException.ConnectionLostException, e 
     270        except dException.DBQueryException, e: 
     271            # Something failed; reset things. 
     272            if useTransact: 
     273                cursor.rollbackTransaction() 
     274            # Pass the exception to the UI 
     275            self.RowNumber = current_row 
     276            raise dException.DBQueryException, e 
     277        except dException.dException, e: 
     278            if useTransact: 
     279                cursor.rollbackTransaction() 
     280            self.RowNumber = current_row 
     281            raise 
    285282 
    286283        if useTransact: 
     
    387384            # normally not be a problem. 
    388385            ignoreNoRecords = True 
    389  
    390386        # Tell the cursor and all children to cancel themselves: 
    391387        self._CurrentCursor.cancel(ignoreNoRecords=ignoreNoRecords) 
    392388        for child in self.__children: 
    393389            child.cancelAll(ignoreNoRecords=ignoreNoRecords) 
    394  
    395390        self.afterCancel() 
    396391         
     
    619614        for key, cursor in cursors.iteritems(): 
    620615            self._CurrentCursor = key 
    621             changed_keys = list(set(cursor._mementos.keys() + cursor._newRecords.keys())
    622             for pk in changed_keys: 
    623                 self._positionUsingPK(pk
     616            changedRows = self.getChangedRows(
     617            for row in changedRows: 
     618                self._moveToRowNum(row
    624619                try: 
    625620                    func(*args, **kwargs)