From 5fb5457a2bedcf7369c2f04513bceb0237924877 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Wed, 6 Sep 2006 13:45:10 +0000
Subject: [PATCH] use the method updateProperty of the PropertyManager when it
 is necessary, this should fix new bugs founds by Jerome

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9704 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Base.py | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py
index 2a9796e814..93ff0c0c07 100644
--- a/product/ERP5Type/Base.py
+++ b/product/ERP5Type/Base.py
@@ -873,10 +873,13 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
       return
     # Finaly use standard PropertyManager
     #LOG("Changing attr: ",0, key)
-    try:
+    # If we are here, this means we do not use a property that
+    # comes from an ERP5 PropertySheet, we should use the
+    # PropertyManager
+    if ERP5PropertyManager.hasProperty(self,key):
+      ERP5PropertyManager._updateProperty(self, key, value)
+    else:
       ERP5PropertyManager._setProperty(self, key, value, type=type)
-    except ConflictError:
-      raise
     # This should not be there, because this ignore all checks made by
     # the PropertyManager. If there is problems, please complain to 
     # seb@nexedi.com
@@ -885,7 +888,6 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
     #  setattr(self, key, value)
 
   def _setPropValue(self, key, value, **kw):
-    #LOG('_setPropValue', 0, 'self = %r, key = %r, value = %r, kw = %r' % (self, key, value, kw))
     self._wrapperCheck(value)
     if isinstance(value, list):
       value = tuple(value)
@@ -916,13 +918,16 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
       return
     # Finaly use standard PropertyManager
     #LOG("Changing attr: ",0, key)
-    try:
-      ERP5PropertyManager._setPropValue(self, key, value)
-    except ConflictError:
-      raise
-    except:
-      # This should be removed if we want strict property checking
-      setattr(self, key, value)
+    #try:
+    ERP5PropertyManager._setPropValue(self, key, value)
+    #except ConflictError:
+    #  raise
+    # This should not be there, because this ignore all checks made by
+    # the PropertyManager. If there is problems, please complain to 
+    # seb@nexedi.com
+    #except:
+    #  # This should be removed if we want strict property checking
+    #  setattr(self, key, value)
 
   security.declareProtected( Permissions.View, 'hasProperty' )
   def hasProperty(self, key):
-- 
2.30.9