Commit f5208627 authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_config: constructTemplatePath should return None in case the path doesn't...

bt5_config: constructTemplatePath should return None in case the path doesn't exist yet. Needed for cases where we are creating a new path_item object
parent 0b3a5988
...@@ -706,6 +706,7 @@ class BusinessItem(XMLObject): ...@@ -706,6 +706,7 @@ class BusinessItem(XMLObject):
new_template_path_list = list(template_path_list) new_template_path_list = list(template_path_list)
# Remove the old path and append it with new path in template_path_list # Remove the old path and append it with new path in template_path_list
# for the parent Business Manager # for the parent Business Manager
if old_path:
new_template_path_list.remove(old_path) new_template_path_list.remove(old_path)
new_template_path_list.append(new_path) new_template_path_list.append(new_path)
manager.setProperty('template_path_list', new_template_path_list) manager.setProperty('template_path_list', new_template_path_list)
...@@ -719,7 +720,14 @@ class BusinessItem(XMLObject): ...@@ -719,7 +720,14 @@ class BusinessItem(XMLObject):
item_path = self.getProperty('item_path') item_path = self.getProperty('item_path')
item_sign = self.getProperty('item_sign') item_sign = self.getProperty('item_sign')
item_layer = self.getProperty('item_layer') item_layer = self.getProperty('item_layer')
return (' | ').join([item_path, str(item_sign), str(item_layer)]) # Try creating template path from the item path,layer and sign
try:
path = (' | ').join([item_path, str(item_sign), str(item_layer)])
except TypeError:
# In case any of item_sign, item_path or item_layer are NoneType or empty,
# just return None
path = None
return path
def build(self, context, **kw): def build(self, context, **kw):
""" """
...@@ -1059,6 +1067,7 @@ class BusinessPropertyItem(XMLObject): ...@@ -1059,6 +1067,7 @@ class BusinessPropertyItem(XMLObject):
new_template_path_list = list(template_path_list) new_template_path_list = list(template_path_list)
# Remove the old path and append it with new path in template_path_list # Remove the old path and append it with new path in template_path_list
# for the parent Business Manager # for the parent Business Manager
if old_path:
new_template_path_list.remove(old_path) new_template_path_list.remove(old_path)
new_template_path_list.append(new_path) new_template_path_list.append(new_path)
manager.setProperty('template_path_list', new_template_path_list) manager.setProperty('template_path_list', new_template_path_list)
...@@ -1072,7 +1081,14 @@ class BusinessPropertyItem(XMLObject): ...@@ -1072,7 +1081,14 @@ class BusinessPropertyItem(XMLObject):
item_path = self.getProperty('item_path') item_path = self.getProperty('item_path')
item_sign = self.getProperty('item_sign') item_sign = self.getProperty('item_sign')
item_layer = self.getProperty('item_layer') item_layer = self.getProperty('item_layer')
return (' | ').join([item_path, str(item_sign), str(item_layer)]) # Try creating template path from the item path,layer and sign
try:
path = (' | ').join([item_path, str(item_sign), str(item_layer)])
except TypeError:
# In case any of item_sign, item_path or item_layer are NoneType or empty,
# just return None
path = None
return path
def build(self, context, **kw): def build(self, context, **kw):
p = context.getPortalObject() p = context.getPortalObject()
......
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