Commit b98a3020 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Ignore an error, if the report section list is empty

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9002 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c4b8d65f
...@@ -1594,32 +1594,37 @@ class ListBoxRenderer: ...@@ -1594,32 +1594,37 @@ class ListBoxRenderer:
# Make a list of lines. # Make a list of lines.
line_class = self.getLineClass() line_class = self.getLineClass()
line_list = [] line_list = []
section_index = 0
current_section_base_index = 0 try:
current_section = report_section_list[0] section_index = 0
current_section_size = current_section.object_list_len current_section_base_index = 0
for i in range(start, end): current_section = report_section_list[0]
# Make sure we go to the right section. current_section_size = current_section.object_list_len
while current_section_base_index + current_section_size <= i: for i in range(start, end):
current_section_base_index += current_section_size # Make sure we go to the right section.
section_index += 1 while current_section_base_index + current_section_size <= i:
current_section = report_section_list[section_index] current_section_base_index += current_section_size
current_section_size = current_section.object_list_len section_index += 1
current_section = report_section_list[section_index]
offset = i - current_section_base_index + current_section.offset current_section_size = current_section.object_list_len
if current_section.is_summary:
index = None offset = i - current_section_base_index + current_section.offset
elif self.isReportTreeMode(): if current_section.is_summary:
index = offset index = None
else: elif self.isReportTreeMode():
index = i index = offset
#LOG('ListBox', 0, 'current_section.__dict__ = %r' % (current_section.__dict__,)) else:
line = line_class(renderer = self, obj = current_section.object_list[offset], index = i
index = index, is_summary = current_section.is_summary, #LOG('ListBox', 0, 'current_section.__dict__ = %r' % (current_section.__dict__,))
context = current_section.context, is_open = current_section.is_open, line = line_class(renderer = self, obj = current_section.object_list[offset],
domain_selection = current_section.domain_selection, index = index, is_summary = current_section.is_summary,
depth = current_section.depth) context = current_section.context, is_open = current_section.is_open,
line_list.append(line) domain_selection = current_section.domain_selection,
depth = current_section.depth)
line_list.append(line)
except IndexError:
# If the report section list is empty, nothing to do.
pass
return line_list return line_list
......
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