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

bt5_config: Only add property values after removing the old value

parent ca9709c6
...@@ -798,9 +798,11 @@ class BusinessItem(Implicit, Persistent): ...@@ -798,9 +798,11 @@ class BusinessItem(Implicit, Persistent):
self.isProperty = True self.isProperty = True
relative_url, property_id = self._path.split('#') relative_url, property_id = self._path.split('#')
obj = portal.unrestrictedTraverse(relative_url) 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 prop = self._value
# 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']) obj.setProperty(prop['name'], prop['value'], prop['type'])
else: else:
path_list = self._path.split('/') path_list = self._path.split('/')
......
...@@ -1842,7 +1842,11 @@ class TemplateTool (BaseTool): ...@@ -1842,7 +1842,11 @@ class TemplateTool (BaseTool):
# Compare new item hash with ZODB # Compare new item hash with ZODB
if new_item._sha == obj_sha: if new_item._sha == obj_sha:
# If same hash, do nothing 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 continue
else: else:
......
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