From da05891014bbfc8f2a7795a9486bc25781545565 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Thu, 20 Jan 2005 08:55:44 +0000 Subject: [PATCH] Bug correction for list render format. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2249 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Form/MatrixBox.py | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/product/ERP5Form/MatrixBox.py b/product/ERP5Form/MatrixBox.py index 6c82a1ceda..317d276043 100755 --- a/product/ERP5Form/MatrixBox.py +++ b/product/ERP5Form/MatrixBox.py @@ -257,25 +257,35 @@ class MatrixBoxWidget(Widget.Widget): kwd = {} kwd['base_id'] = cell_base_id cell = getter_method(*kw, **kwd) + cell_body = '' + for attribute_id in editable_attribute_ids: my_field_id = '%s_%s' % (field.id, attribute_id) if form.has_field(my_field_id): my_field = form.get_field(my_field_id) key = my_field.id + '_cell_%s_%s_%s' % (i,j, k) - #LOG("Cell",0,str(cell)) - #LOG("Cell",0,str(getter_method)) - #LOG("Cell",0,str(kwd)) - #LOG("Cell",0,str(kw)) - attribute_value = my_field.get_value('default', cell = cell, - cell_index = kw, cell_position = (i,j, k)) + + if cell != None: + attribute_value = my_field.get_value('default', cell = cell, cell_index = kw, cell_position = (i,j, k)) - if render_format == 'list': - if not my_field.get_value('hidden'): - list_result_lines.append(attribute_value) - - REQUEST['cell'] = cell - cell_body += str(my_field.render(value = attribute_value, REQUEST = REQUEST, key = key)) + if render_format=='html': + REQUEST['cell'] = cell + cell_body += str(my_field.render(value = attribute_value, REQUEST = REQUEST, key = key)) + + elif render_format == 'list': + if not my_field.get_value('hidden'): + list_result_lines.append(attribute_value) + + else: + if render_format == 'html': + # XXX no cell exists, we need to display a correct field, without generate plenty of errors... + cell_body += str(my_field.render(value = None, REQUEST=REQUEST, key=key)) + + elif render_format == 'list': + if not my_field.get_value('hidden'): + list_result_lines.append(None) + list_body = list_body + \ ('<td class=\"%s\">%s</td>' % (td_css, cell_body)) -- 2.30.9