Commit 0b16904e authored by Sebastien Robin's avatar Sebastien Robin

access to cell in tales expression


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1047 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f8e5e681
......@@ -1003,12 +1003,26 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
else:
property_id = alias
# attribute_value = getattr(o, cname_id) # FUTURE WAY OF DOING TGW Brains
my_field = None
tales_expr = None
if form.has_field('%s_%s' % (field.id, alias) ):
my_field_id = '%s_%s' % (field.id, alias)
my_field = form.get_field(my_field_id)
tales_expr = my_field.tales.get('default', "")
if tales_expr:
#
real_o = o
if hasattr(o,'getObject'): # we have a line of sql result
real_o = o.getObject()
field_kw = {'cell':real_o}
attribute_value = my_field.__of__(real_o).get_value('default',**field_kw)
else:
if hasattr(aq_self(o),alias): # Block acquisition to reduce risks
# First take the indexed value
attribute_value = getattr(o,alias) # We may need acquisition in case of method call
else:
# MUST IMPROVE FOR PERFORMANCE REASON
# attribute_value = 'Does not exist'
# MUST IMPROVE FOR PERFORMANCE REASON
# attribute_value = 'Does not exist'
if real_o is None:
try:
real_o = o.getObject()
......@@ -1047,8 +1061,6 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
else:
td_align = "left"
if sql in editable_column_ids and form.has_field('%s_%s' % (field.id, alias) ):
my_field_id = '%s_%s' % (field.id, alias)
my_field = form.get_field(my_field_id)
key = my_field.id + '_%s' % o.uid
if field_errors.has_key(key):
error_css = 'Error'
......
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