From 4a9712b03e98f7ae447e03501158f32d50665da5 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Fri, 19 Mar 2010 08:29:27 +0000
Subject: [PATCH] Here we avoid calling field.get_recursive_orig_value on all
 fields because it can be acquired from another field in context. ie, from a
 listbox field. AttributeError is not raised and get_recursive_orig_value does
 not exists neither on that field. So, test condition on meta_type attribute
 to avoid non desirable side effects.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33899 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/Form.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Form/Form.py b/product/ERP5Form/Form.py
index b5fb92a61e..6db6cdda6d 100644
--- a/product/ERP5Form/Form.py
+++ b/product/ERP5Form/Form.py
@@ -202,9 +202,14 @@ class TALESValue(StaticValue):
           'Field.get_value ( %s/%s [%s]), exception on tales_expr: ' %
           ( form.getId(), field.getId(), id), error=sys.exc_info())
       # field may be ProxyField
-      try:
+      # here we avoid calling field.get_recursive_orig_value
+      # on all fields because it can be acquired from another
+      # field in context. ie, from a listbox field.
+      # So, test condition on meta_type attribute to avoid
+      # non desirable side effects.
+      if field.meta_type == 'ProxyField':
         value = field.get_recursive_orig_value(id)
-      except AttributeError:
+      else:
         value = field.get_orig_value(id)
 
     return self.returnValue(field, id, value)
-- 
2.30.9