Commit ea43a9b7 authored by Jérome Perrin's avatar Jérome Perrin

The way Listbox_getReportTreeStructure calls a function recursively on each...

The way Listbox_getReportTreeStructure calls a function recursively on each line makes it often it the max recursion depth. It is also called unnecessarily when the tree is open but nothing is selected. For now don't make it recurse when it's open but not selected

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44336 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1881e09e
...@@ -56,7 +56,7 @@ structure = {}\n ...@@ -56,7 +56,7 @@ structure = {}\n
structure[\'line\'] = None\n structure[\'line\'] = None\n
structure[\'line_list\'] = []\n structure[\'line_list\'] = []\n
\n \n
if not (is_report_tree_mode or is_domain_tree_mode):\n if not ((is_report_tree_mode or is_domain_tree_mode) and max_section_depth):\n
# When this is not a report tree, return the "plain structure"\n # When this is not a report tree, return the "plain structure"\n
structure[\'line\'] = None\n structure[\'line\'] = None\n
structure[\'line_list\'] = [dict(line=x, line_list=[]) for x in listbox_line_list]\n structure[\'line_list\'] = [dict(line=x, line_list=[]) for x in listbox_line_list]\n
...@@ -83,6 +83,8 @@ def order_line_list(line_list, current_structure, depth=0, index=0, last_dict=No ...@@ -83,6 +83,8 @@ def order_line_list(line_list, current_structure, depth=0, index=0, last_dict=No
else:\n else:\n
return index\n return index\n
if index < len(line_list):\n if index < len(line_list):\n
# FIXME: this way of recursing is not appropriate, as we reach very easily the maximum\n
# recursion depth from python.\n
index = order_line_list(line_list, current_structure, depth=depth, index=index, last_dict=last_dict)\n index = order_line_list(line_list, current_structure, depth=depth, index=index, last_dict=last_dict)\n
return index\n return index\n
\n \n
...@@ -95,7 +97,7 @@ return structure\n ...@@ -95,7 +97,7 @@ return structure\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>listbox_line_list=None, is_report_tree_mode=False, is_domain_tree_mode=False</string> </value> <value> <string>listbox_line_list=None, is_report_tree_mode=False, is_domain_tree_mode=False, max_section_depth=0</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -57,9 +57,9 @@ ...@@ -57,9 +57,9 @@
selection python: here.portal_selections.getSelectionFor(selection_name, REQUEST=request);\n selection python: here.portal_selections.getSelectionFor(selection_name, REQUEST=request);\n
is_report_tree_mode selection/report_tree_mode | python: 0;\n is_report_tree_mode selection/report_tree_mode | python: 0;\n
is_domain_tree_mode selection/domain_tree_mode | python: 0;\n is_domain_tree_mode selection/domain_tree_mode | python: 0;\n
listbox_line_structure python: here.Listbox_getReportTreeStructure(listbox_line_list=listboxline_list[1:], is_report_tree_mode=is_report_tree_mode, is_domain_tree_mode=is_domain_tree_mode);\n
listboxline python:listboxline_list[0];\n
max_section_depth python: max([x.getSectionDepth() for x in listboxline_list]) + int(is_report_tree_mode);\n max_section_depth python: max([x.getSectionDepth() for x in listboxline_list]) + int(is_report_tree_mode);\n
listbox_line_structure python: here.Listbox_getReportTreeStructure(listbox_line_list=listboxline_list[1:], is_report_tree_mode=is_report_tree_mode, is_domain_tree_mode=is_domain_tree_mode, max_section_depth=max_section_depth);\n
listboxline python:listboxline_list[0];\n
" i18n:domain="ui">\n " i18n:domain="ui">\n
\n \n
<tal:block tal:condition="listboxline/isTitleLine">\n <tal:block tal:condition="listboxline/isTitleLine">\n
......
251 252
\ No newline at end of file \ No newline at end of file
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