Commit 8ddaf72f authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_config: Only add property values after removing the old value

parent ca9709c6
......@@ -798,10 +798,12 @@ class BusinessItem(Implicit, Persistent):
self.isProperty = True
relative_url, property_id = self._path.split('#')
obj = portal.unrestrictedTraverse(relative_url)
# XXX: Here, we do deal with different cases such as if the object exists
# or not or have the same value or compare states
prop = self._value
obj.setProperty(prop['name'], prop['value'], prop['type'])
# First remove the property from the existing path and keep the default
# empty, and update only if the sign is +1
obj._delPropValue(prop['name'])
if self._sign == 1:
obj.setProperty(prop['name'], prop['value'], prop['type'])
else:
path_list = self._path.split('/')
container_path = path_list[:-1]
......
......@@ -1842,8 +1842,12 @@ class TemplateTool (BaseTool):
# Compare new item hash with ZODB
if new_item._sha == obj_sha:
# If same hash, do nothing
continue
if new_item._sign == -1:
# If the sign is negative, remove the value from the path
new_item.install(installation_process)
else:
# If same hash, and +1 sign, do nothing
continue
else:
# Install the new_item
......
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