dabo Commit
Revision 5022
Date: 2009-02-05 15:44:53 -0800 (Thu, 05 Feb 2009)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5022
Changed:
U trunk/dabo/biz/dBizobj.py
Log:
Added a reverse argument to biz.scan(). It is hidden to allow for kwargs
without sending the reverse argument, but it seems better for the reverse
behavior to be encapsulated within a given scan() call rather than setting
biz.ScanReverse globally.
Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py 2009-02-05 18:33:01 UTC (rev 5021)
+++ trunk/dabo/biz/dBizobj.py 2009-02-05 23:44:53 UTC (rev 5022)
@@ -678,8 +678,12 @@
Set self.exitScan to True to exit the scan on the next
iteration.
If self.ScanRestorePosition is True, the position of the current
- record in the recordset is restored after the iteration. If
- self.ScanReverse is True, the records are processed in reverse
order.
+ record in the recordset is restored after the iteration.
+
+ You may optionally send reverse=True to scan the records in
reverse
+ order, which you'll want to do if, for example, you are
deleting
+ records in your scan function. If the reverse argument is not
sent,
+ self.ScanReverse will be queried to determine the behavior.
"""
self.scanRows(func, range(self.RowCount), *args, **kwargs)
@@ -693,6 +697,11 @@
self.exitScan = False
rows = list(rows)
try:
+ reverse = kwargs["reverse"]
+ del(kwargs["reverse"])
+ except KeyError:
+ reverse = self.ScanReverse
+ try:
currPK = self.getPK()
currRow = None
except dException.dException:
@@ -715,7 +724,7 @@
self.RowNumber = row
try:
- if self.ScanReverse:
+ if reverse:
rows.reverse()
for i in rows:
self._moveToRowNum(i)
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]