From ea43a9b7d024578c869a85a689f4b4e62e956e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Wed, 16 Mar 2011 11:10:56 +0000 Subject: [PATCH] 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 --- .../erp5_ods_style/Listbox_getReportTreeStructure.xml | 6 ++++-- .../portal_skins/erp5_ods_style/listbox_ods_macro.xml | 4 ++-- bt5/erp5_ods_style/bt/revision | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/Listbox_getReportTreeStructure.xml b/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/Listbox_getReportTreeStructure.xml index c273987fb4..3de4e69d63 100644 --- a/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/Listbox_getReportTreeStructure.xml +++ b/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/Listbox_getReportTreeStructure.xml @@ -56,7 +56,7 @@ structure = {}\n structure[\'line\'] = None\n structure[\'line_list\'] = []\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 structure[\'line\'] = None\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 else:\n return index\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 return index\n \n @@ -95,7 +97,7 @@ return structure\n </item> <item> <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> <key> <string>id</string> </key> diff --git a/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.xml b/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.xml index f34cf060d1..5a347a9f39 100644 --- a/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.xml +++ b/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.xml @@ -57,9 +57,9 @@ selection python: here.portal_selections.getSelectionFor(selection_name, REQUEST=request);\n is_report_tree_mode selection/report_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 + 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 \n <tal:block tal:condition="listboxline/isTitleLine">\n diff --git a/bt5/erp5_ods_style/bt/revision b/bt5/erp5_ods_style/bt/revision index f123c4f4b5..1c5fd036ef 100644 --- a/bt5/erp5_ods_style/bt/revision +++ b/bt5/erp5_ods_style/bt/revision @@ -1 +1 @@ -251 \ No newline at end of file +252 \ No newline at end of file -- 2.30.9