summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e4f94c6)
raw | patch | inline | side by side (parent: e4f94c6)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 23 Sep 2002 01:01:06 +0000 (01:01 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 23 Sep 2002 01:01:06 +0000 (01:01 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1206 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/cgi/templating.py | patch | blob | history |
index 1de56e1ce1d42b1503959af6015915b1961f6203..781afb0424f69210f6099890a51e675d09e3b08f 100644 (file)
matches = None
l = klass.filter(matches, filterspec, sort, group)
- # map the item ids to instances
- if self.classname == 'user':
- klass = HTMLUser
- else:
- klass = HTMLItem
- l = [klass(self.client, self.classname, item) for item in l]
-
- # return the batch object
- return Batch(self.client, l, self.pagesize, self.startwith)
+ # return the batch object, using IDs only
+ return Batch(self.client, l, self.pagesize, self.startwith,
+ classname=self.classname)
# extend the standard ZTUtils Batch object to remove dependency on
# Acquisition and add a couple of useful methods
========= ========================================================
Parameter Usage
========= ========================================================
- sequence a list of HTMLItems
+ sequence a list of HTMLItems or item ids
+ classname if sequence is a list of ids, this is the class of item
size how big to make the sequence.
start where to start (0-indexed) in the sequence.
end where to end (0-indexed) in the sequence.
"sequence_length" is the length of the original, unbatched, sequence.
'''
def __init__(self, client, sequence, size, start, end=0, orphan=0,
- overlap=0):
+ overlap=0, classname=None):
self.client = client
self.last_index = self.last_item = None
self.current_item = None
+ self.classname = classname
self.sequence_length = len(sequence)
ZTUtils.Batch.__init__(self, sequence, size, start, end, orphan,
overlap)
self.last_item = self.current_item
self.last_index = index
- self.current_item = self._sequence[index + self.first]
- return self.current_item
+ item = self._sequence[index + self.first]
+ if self.classname:
+ # map the item ids to instances
+ if self.classname == 'user':
+ item = HTMLUser(self.client, self.classname, item)
+ else:
+ item = HTMLItem(self.client, self.classname, item)
+ self.current_item = item
+ return item
def propchanged(self, property):
''' Detect if the property marked as being the group property