From 26b51a0f321e59100f0eead3ca2ac1678fdce3a3 Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Tue, 14 Jun 2016 16:38:25 +0200 Subject: [PATCH] Do not cache an attribute that is never used 'keep_existing' argument of Base._edit has never been used and we should consider removing it. --- product/ERP5Type/Base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index a0daa05d52..90342c3769 100644 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -1427,7 +1427,6 @@ class Base( CopyContainer, restricted_method_set = () getProperty = self.getProperty - hasProperty = self.hasProperty _setProperty = self._setProperty def setChangedPropertyList(key_list): @@ -1446,13 +1445,14 @@ class Base( CopyContainer, not_modified_list.append(key) continue + # If the keep_existing flag is set to 1, + # we do not update properties which are defined + if keep_existing and self.hasProperty(key): + continue # We keep in a thread var the previous values # this can be useful for interaction workflow to implement lookups # XXX If iteraction workflow script is triggered by edit and calls # edit itself, this is useless as the dict will be overwritten - # If the keep_existing flag is set to 1, we do not update properties which are defined - if keep_existing and hasProperty(key): - continue if restricted: accessor_name = 'set' + UpperCase(key) if accessor_name in restricted_method_set: -- 2.30.9