[Checkins] SVN: z3c.table/branches/lazyvalues2/src/z3c/table/table.py when IValues is smart enough to have sorted and batched rows, do not sort or batch
Godefroid Chapelle
gotcha at bubblenet.be
Fri Aug 20 04:33:10 EDT 2010
Log message for revision 115823:
when IValues is smart enough to have sorted and batched rows, do not sort or batch
Changed:
U z3c.table/branches/lazyvalues2/src/z3c/table/table.py
-=-
Modified: z3c.table/branches/lazyvalues2/src/z3c/table/table.py
===================================================================
--- z3c.table/branches/lazyvalues2/src/z3c/table/table.py 2010-08-20 08:11:32 UTC (rev 115822)
+++ z3c.table/branches/lazyvalues2/src/z3c/table/table.py 2010-08-20 08:33:09 UTC (rev 115823)
@@ -203,13 +203,12 @@
or (self.hasSortedValues and self.valuesSortedOn != self.sortOn)))
def sortRows(self):
- if self._mustSort():
- sortOnIdx = self.columnIndexById.get(self.sortOn, 0)
- sortKeyGetter = getSortMethod(sortOnIdx)
- rows = sorted(self.rows, key=sortKeyGetter)
- if self.sortOrder in self.reverseSortOrderNames:
- rows.reverse()
- self.rows = rows
+ sortOnIdx = self.columnIndexById.get(self.sortOn, 0)
+ sortKeyGetter = getSortMethod(sortOnIdx)
+ rows = sorted(self.rows, key=sortKeyGetter)
+ if self.sortOrder in self.reverseSortOrderNames:
+ rows.reverse()
+ self.rows = rows
# batch
@@ -221,6 +220,9 @@
return int(self.request.get(self.prefix + '-batchStart',
self.batchStart))
+ def _mustBatch(self):
+ return not IBatch.providedBy(self.rows)
+
def batchRows(self):
if len(self.rows) > self.startBatchingAt:
self.rows = createObject("z3c.batching.batch", self.rows,
@@ -327,10 +329,12 @@
self.rows = self.setUpRows()
# sort items on columns
- self.sortRows()
+ if self._mustSort():
+ self.sortRows()
# batch sorted rows
- self.batchRows()
+ if self._mustBatch():
+ self.batchRows()
self.updateBatch()
More information about the checkins
mailing list