[Erp5-report] r44336 jerome - in /erp5/trunk/bt5/erp5_ods_style: SkinTemplateItem/portal_sk...

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 16 12:10:56 CET 2011


Author: jerome
Date: Wed Mar 16 12:10:56 2011
New Revision: 44336

URL: http://svn.erp5.org?rev=44336&view=rev
Log:
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

Modified:
    erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/Listbox_getReportTreeStructure.xml
    erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.xml
    erp5/trunk/bt5/erp5_ods_style/bt/revision

Modified: erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/Listbox_getReportTreeStructure.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/Listbox_getReportTreeStructure.xml?rev=44336&r1=44335&r2=44336&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/Listbox_getReportTreeStructure.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/Listbox_getReportTreeStructure.xml [utf8] Wed Mar 16 12:10:56 2011
@@ -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_s
     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>

Modified: erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.xml?rev=44336&r1=44335&r2=44336&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.xml [utf8] Wed Mar 16 12:10:56 2011
@@ -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

Modified: erp5/trunk/bt5/erp5_ods_style/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ods_style/bt/revision?rev=44336&r1=44335&r2=44336&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ods_style/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_ods_style/bt/revision [utf8] Wed Mar 16 12:10:56 2011
@@ -1 +1 @@
-251
\ No newline at end of file
+252
\ No newline at end of file



More information about the Erp5-report mailing list