Commit 3b491a5d authored by Alexandre Boeglin's avatar Alexandre Boeglin

Fixed recursion problem in makeTreeList (related to report_path and base_category).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1778 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2a4e9972
...@@ -107,7 +107,7 @@ def makeTreeBody(form, root_dict, domain_path, depth, total_depth, unfolded_list ...@@ -107,7 +107,7 @@ def makeTreeBody(form, root_dict, domain_path, depth, total_depth, unfolded_list
domain_path = domain_path[1:] domain_path = domain_path[1:]
else: else:
domain_path = () domain_path = ()
is_empty_level = (len(root.objectIds()) == 0) and (domain_path is not ()) is_empty_level = (root.objectCount() == 0) and (len(report_path) != 0)
if is_empty_level: base_category = domain_path[0] if is_empty_level: base_category = domain_path[0]
tree_body = '' tree_body = ''
...@@ -129,7 +129,7 @@ def makeTreeBody(form, root_dict, domain_path, depth, total_depth, unfolded_list ...@@ -129,7 +129,7 @@ def makeTreeBody(form, root_dict, domain_path, depth, total_depth, unfolded_list
return tree_body return tree_body
def makeTreeList(form, root_dict, report_path, depth, unfolded_list, form_id, selection_name, report_depth): def makeTreeList(form, root_dict, report_path, base_category, depth, unfolded_list, form_id, selection_name, report_depth):
""" """
(object, is_pure_summary, depth, is_open, select_domain_dict) (object, is_pure_summary, depth, is_open, select_domain_dict)
...@@ -143,8 +143,6 @@ def makeTreeList(form, root_dict, report_path, depth, unfolded_list, form_id, se ...@@ -143,8 +143,6 @@ def makeTreeList(form, root_dict, report_path, depth, unfolded_list, form_id, se
if len(report_path): if len(report_path):
base_category = report_path[0] base_category = report_path[0]
else:
base_category = None
if root_dict is None: if root_dict is None:
root_dict = {} root_dict = {}
...@@ -169,12 +167,8 @@ def makeTreeList(form, root_dict, report_path, depth, unfolded_list, form_id, se ...@@ -169,12 +167,8 @@ def makeTreeList(form, root_dict, report_path, depth, unfolded_list, form_id, se
report_path = () report_path = ()
else: else:
root = root_dict[None] = root_dict[base_category] root = root_dict[None] = root_dict[base_category]
if len(report_path) >= 1:
report_path = report_path[1:] report_path = report_path[1:]
else: is_empty_level = (root.objectCount() == 0) and (len(report_path) != 0)
report_path = ()
is_empty_level = 0 # Stop infinite loop
is_empty_level = (len(root.objectIds()) == 0) and (report_path is not ())
if is_empty_level: base_category = report_path[0] if is_empty_level: base_category = report_path[0]
tree_list = [] tree_list = []
...@@ -187,7 +181,7 @@ def makeTreeList(form, root_dict, report_path, depth, unfolded_list, form_id, se ...@@ -187,7 +181,7 @@ def makeTreeList(form, root_dict, report_path, depth, unfolded_list, form_id, se
if (report_depth is not None and depth <= (report_depth - 1)) or o.getRelativeUrl() in unfolded_list: if (report_depth is not None and depth <= (report_depth - 1)) or o.getRelativeUrl() in unfolded_list:
tree_list += [(o, 1, depth, 1, selection_domain)] # Summary (open) tree_list += [(o, 1, depth, 1, selection_domain)] # Summary (open)
tree_list += [(o, 0, depth, 0, selection_domain)] # List (contents, closed, must be strict selection) tree_list += [(o, 0, depth, 0, selection_domain)] # List (contents, closed, must be strict selection)
tree_list += makeTreeList(form, new_root_dict, report_path, depth + 1, unfolded_list, form_id, selection_name, report_depth) tree_list += makeTreeList(form, new_root_dict, report_path, base_category, depth + 1, unfolded_list, form_id, selection_name, report_depth)
else: else:
tree_list += [(o, 1, depth, 0, selection_domain)] # Summary (closed) tree_list += [(o, 1, depth, 0, selection_domain)] # Summary (closed)
...@@ -775,7 +769,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -775,7 +769,7 @@ class ListBoxWidget(Widget.Widget):
selection_report_current = () selection_report_current = ()
else: else:
selection_report_current = selection.getReportList() selection_report_current = selection.getReportList()
report_tree_list = makeTreeList(form, None, selection_report_path, report_tree_list = makeTreeList(form, None, selection_report_path, None,
0, selection_report_current, form.id, selection_name, report_depth ) 0, selection_report_current, form.id, selection_name, report_depth )
# Update report list if report_depth was specified # Update report list if report_depth was specified
......
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