Commit d6ffba49 authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_config: Rename properties to not have conflicts

parent 3f396373
......@@ -339,7 +339,6 @@ class BusinessManager(Folder):
for path_item in path_item_list:
if '#' in str(path_item[0]):
import pdb; pdb.set_trace()
PathItem = self.newContent(portal_type='Business Property Item')
# If its a property, no need to resolve the path
PathItem.edit(
......@@ -922,18 +921,18 @@ class BusinessPropertyItem(XMLObject):
obj = p.unrestrictedTraverse(relative_url)
property_value = obj.getProperty(property_id)
property_type = obj.getPropertyType(property_id)
self.setProperty('name', property_id)
self.setProperty('type', property_type)
self.setProperty('value', property_value)
self.setProperty('item_property_name', property_id)
self.setProperty('item_property_type', property_type)
self.setProperty('item_property_value', property_value)
def install(self, context):
portal = context.getPortalObject()
path = self.getProperty('item_path')
relative_url, property_id = path.split('#')
obj = portal.unrestrictedTraverse(relative_url)
property_name = self.getProperty('name')
property_type = self.getProperty('type')
property_value = self.getProperty('value')
property_name = self.getProperty('item_property_name')
property_type = self.getProperty('item_property_type')
property_value = self.getProperty('item_property_value')
# First remove the property from the existing path and keep the default
# empty, and update only if the sign is +1
obj._delPropValue(property_name)
......
......@@ -1773,12 +1773,14 @@ class TemplateTool (BaseTool):
# Update hashes of item in old state before installation
for item in old_installation_state.objectValues():
if item.isProperty:
value_list = item.getProperty('value')
value = item.getProperty('item_property_value')
else:
value_list = item.objectValues()
if value_list:
if value_list:
value = value_list[0]
if value:
item.setProperty('item_sha', self.calculateComparableHash(
value_list[0],
value,
item.isProperty,
))
......@@ -1788,9 +1790,8 @@ class TemplateTool (BaseTool):
# If the path has been removed, then add it with sign = -1
old_item = old_installation_state.getBusinessItemByPath(item.getProperty('item_path'))
# Calculate sha for the items in new_insatallation_state
import pdb; pdb.set_trace()
if item.isProperty:
value = item.getProperty('value')
value = item.getProperty('item_property_value')
else:
value = item.objectValues()[0]
item.setProperty('item_sha', self.calculateComparableHash(
......@@ -1953,10 +1954,11 @@ class TemplateTool (BaseTool):
# XXX: Hack for not trying to install the sub-objects from zexp,
# This should rather be implemented while exporting the object,
# where we shouldn't export sub-objects in the zexp
try:
value = new_item.objectValues()[0]
except IndexError:
continue
if not isProperty:
try:
value = new_item.objectValues()[0]
except IndexError:
continue
new_item.install(installation_process)
return error_list
......
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