Changeset 3116
- Timestamp:
- 05/09/07 06:47:01 (2 years ago)
- Files:
-
- branches/stable/dabo/biz/dBizobj.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/stable/dabo/biz/dBizobj.py
r3093 r3116 49 49 self._baseClass = dBizobj 50 50 self.__areThereAnyChanges = False # Used by the isChanged() method. 51 # Next two are used by the scan() method.52 self.__scanRestorePosition = True53 self.__scanReverse = False54 51 # Used by the LinkField property 55 52 self._linkField = "" … … 63 60 self._caption = "" 64 61 self._dataSource = "" 62 self._scanRestorePosition = None 65 63 self._SQL = "" 66 64 self._requeryOnLoad = False … … 544 542 545 543 546 def scan(self, func, *args, **kwargs):544 def scan(self, func, reverse=False, *args, **kwargs): 547 545 """Iterate over all records and apply the passed function to each. 548 546 549 547 Set self.exitScan to True to exit the scan on the next iteration. 550 548 551 If self. __scanRestorePosition is True, the position of the current552 record in the recordset is restored after the iteration. If 553 self.__scanReverse is true, the records are processed in reverse order.554 """ 555 self.scanRows(func, range(self.RowCount), *args, **kwargs)556 557 558 def scanRows(self, func, rows, *args, **kwargs):549 If self.ScanRestorePosition is True, the position of the current 550 record in the recordset is restored after the iteration. If the 'reverse' 551 parameter is True, the records are processed in reverse order. 552 """ 553 self.scanRows(func, range(self.RowCount), reverse=reverse, *args, **kwargs) 554 555 556 def scanRows(self, func, rows, reverse=False, *args, **kwargs): 559 557 """Iterate over the specified rows and apply the passed function to each. 560 558 … … 564 562 self.exitScan = False 565 563 rows = list(rows) 566 if self. __scanRestorePosition:564 if self.ScanRestorePosition: 567 565 try: 568 566 currPK = self.getPK() … … 573 571 currRow = self.RowNumber 574 572 try: 575 if self.__scanReverse:573 if reverse: 576 574 rows.reverse() 577 575 for i in rows: … … 581 579 break 582 580 except dException.dException, e: 583 if self. __scanRestorePosition:581 if self.ScanRestorePosition: 584 582 self.RowNumber = currRow 585 583 raise dException.dException, e 586 584 587 if self. __scanRestorePosition:585 if self.ScanRestorePosition: 588 586 if currPK is not None: 589 587 self._positionUsingPK(currPK, updateChildren=False) … … 1746 1744 1747 1745 1746 def _getScanRestorePosition(self): 1747 return self._scanRestorePosition 1748 1749 def _setScanRestorePosition(self, val): 1750 self._scanRestorePosition = val 1751 1752 1748 1753 def _getSQL(self): 1749 1754 try: … … 1875 1880 1876 1881 RequeryOnLoad = property(_getRequeryOnLoad, _setRequeryOnLoad, None, 1877 _("""When true, the cursor object runs its query immediately. This1882 _("""When True, the cursor object runs its query immediately. This 1878 1883 is useful for lookup tables or fixed-size (small) tables. (bool)""")) 1879 1884 … … 1901 1906 this behavior, set this to True. (bool)""")) 1902 1907 1908 ScanRestorePosition = property(_getScanRestorePosition, _setScanRestorePosition, None, 1909 _("""After running a scan, do we attempt to restore the record position to 1910 where it was before the scan (True, default), or do we leave the pointer 1911 at the end of the recordset (False). (bool)""")) 1912 1903 1913 SQL = property(_getSQL, _setSQL, None, 1904 1914 _("SQL statement used to create the cursor's data. (str)")) … … 1915 1925 The specified function will be called when getFieldVal() is called on 1916 1926 the specified virtual field name.""")) 1917
