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