Commit 02327264 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Fix a bug in calculating the start... this works, but I do not like this,...

Fix a bug in calculating the start... this works, but I do not like this, because this is dirty. But anyway ListBox is entirely dirty.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3253 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0c2b6f83
...@@ -1021,15 +1021,17 @@ class ListBoxWidget(Widget.Widget): ...@@ -1021,15 +1021,17 @@ class ListBoxWidget(Widget.Widget):
if count_method is not None and not selection.invert_mode: if count_method is not None and not selection.invert_mode:
#LOG('ListBox', 0, 'use count_method %r' % count_method) #LOG('ListBox', 0, 'use count_method %r' % count_method)
# If the count method is available, get only required objects. # If the count method is available, get only required objects.
kw['limit'] = (start, lines)
selection.edit( params = kw, report = None )
object_list = selection(method = list_method, context=here, REQUEST=REQUEST)
del kw['limit']
selection.edit( params = kw, report = None ) selection.edit( params = kw, report = None )
count = selection(method = count_method, context=here, REQUEST=REQUEST) count = selection(method = count_method, context=here, REQUEST=REQUEST)
object_list_len = int(count[0][0]) object_list_len = int(count[0][0])
if start > object_list_len: if start > object_list_len:
start = object_list_len start = object_list_len
start -= (start % lines)
kw['limit'] = (start, lines)
selection.edit( params = kw, report = None )
object_list = selection(method = list_method, context=here, REQUEST=REQUEST)
del kw['limit']
selection.edit( params = kw, report = None ) # XXX Necessary?
# For convenience, add padding into the list of objects with None. # For convenience, add padding into the list of objects with None.
object_list = [None] * start + list(object_list) + [None] * (object_list_len - len(object_list) - start) object_list = [None] * start + list(object_list) + [None] * (object_list_len - len(object_list) - start)
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment