Commit da7ddc78 authored by Aurel's avatar Aurel

change name of some variable to not use 'type'

rename 'btsave' action into 'backup'


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4689 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cc3183fb
...@@ -440,7 +440,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -440,7 +440,7 @@ class ObjectTemplateItem(BaseTemplateItem):
""" """
Backup the object in portal trash if necessery and return its subobjects Backup the object in portal trash if necessery and return its subobjects
""" """
if action == 'btsave': if action == 'backup':
subobjects_dict = self.portal_trash.backupObject(trashbin, container_path, object_id, save=1) subobjects_dict = self.portal_trash.backupObject(trashbin, container_path, object_id, save=1)
elif action == 'install': elif action == 'install':
subobjects_dict = self.portal_trash.backupObject(trashbin, container_path, object_id, save=0) subobjects_dict = self.portal_trash.backupObject(trashbin, container_path, object_id, save=0)
...@@ -463,7 +463,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -463,7 +463,7 @@ class ObjectTemplateItem(BaseTemplateItem):
if action == 'nothing': if action == 'nothing':
continue continue
else: else:
action = 'btsave' action = 'backup'
# get subobjects in path # get subobjects in path
container_path = path.split('/')[:-1] container_path = path.split('/')[:-1]
object_id = path.split('/')[-1] object_id = path.split('/')[-1]
...@@ -530,7 +530,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -530,7 +530,7 @@ class ObjectTemplateItem(BaseTemplateItem):
container = portal.unrestrictedTraverse(container_path) container = portal.unrestrictedTraverse(container_path)
container_ids = container.objectIds() container_ids = container.objectIds()
if object_id in container_ids: # Object already exists if object_id in container_ids: # Object already exists
self._backupObject('btsave', trashbin, container_path, object_id) self._backupObject('backup', trashbin, container_path, object_id)
container.manage_delObjects([object_id]) container.manage_delObjects([object_id])
# Set a hard link # Set a hard link
obj = obj._getCopy(container) obj = obj._getCopy(container)
...@@ -814,7 +814,7 @@ class CategoryTemplateItem(ObjectTemplateItem): ...@@ -814,7 +814,7 @@ class CategoryTemplateItem(ObjectTemplateItem):
if action == 'nothing': if action == 'nothing':
continue continue
else: else:
action = 'btsave' action = 'backup'
# Wrap the object by an aquisition wrapper for _aq_dynamic. # Wrap the object by an aquisition wrapper for _aq_dynamic.
obj = self._objects[path] obj = self._objects[path]
obj = obj.__of__(category_tool) obj = obj.__of__(category_tool)
...@@ -999,7 +999,7 @@ class WorkflowTemplateItem(ObjectTemplateItem): ...@@ -999,7 +999,7 @@ class WorkflowTemplateItem(ObjectTemplateItem):
if action == 'nothing': if action == 'nothing':
continue continue
else: else:
action = 'btsave' action = 'backup'
container_path = path.split('/')[:-1] container_path = path.split('/')[:-1]
object_id = path.split('/')[-1] object_id = path.split('/')[-1]
try: try:
...@@ -1142,7 +1142,7 @@ class PortalTypeTemplateItem(ObjectTemplateItem): ...@@ -1142,7 +1142,7 @@ class PortalTypeTemplateItem(ObjectTemplateItem):
Backup portal type and keep the workflow chain. Backup portal type and keep the workflow chain.
""" """
subobjects_dict = {} subobjects_dict = {}
if action == 'btsave': if action == 'backup':
# Get the chain value # Get the chain value
# (default_chain, chain_dict) = self._getChainByType(self) # (default_chain, chain_dict) = self._getChainByType(self)
# chain = chain_dict['chain_%s' % object_id] # chain = chain_dict['chain_%s' % object_id]
...@@ -1195,13 +1195,13 @@ class PortalTypeTemplateItem(ObjectTemplateItem): ...@@ -1195,13 +1195,13 @@ class PortalTypeTemplateItem(ObjectTemplateItem):
xml = parse(file) xml = parse(file)
chain_list = xml.getElementsByTagName('chain') chain_list = xml.getElementsByTagName('chain')
for chain in chain_list: for chain in chain_list:
type = chain.getElementsByTagName('type')[0].childNodes[0].data ptype = chain.getElementsByTagName('type')[0].childNodes[0].data
workflow_list = chain.getElementsByTagName('workflow')[0].childNodes workflow_list = chain.getElementsByTagName('workflow')[0].childNodes
if len(workflow_list) == 0: if len(workflow_list) == 0:
workflow = '' workflow = ''
else: else:
workflow = workflow_list[0].data workflow = workflow_list[0].data
dict[str(type)] = str(workflow) dict[str(ptype)] = str(workflow)
self._workflow_chain_archive = dict self._workflow_chain_archive = dict
else: else:
ObjectTemplateItem._importFile(self, file_name, file) ObjectTemplateItem._importFile(self, file_name, file)
...@@ -1372,12 +1372,12 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -1372,12 +1372,12 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
expr_instance = Expression(expression) expr_instance = Expression(expression)
else: else:
expr_instance = self._filter_expression_instance_archive[method_id] expr_instance = self._filter_expression_instance_archive[method_id]
type = self._filter_type_archive[method_id] filter_type = self._filter_type_archive[method_id]
catalog.filter_dict[method_id] = PersistentMapping() catalog.filter_dict[method_id] = PersistentMapping()
catalog.filter_dict[method_id]['filtered'] = 1 catalog.filter_dict[method_id]['filtered'] = 1
catalog.filter_dict[method_id]['expression'] = expression catalog.filter_dict[method_id]['expression'] = expression
catalog.filter_dict[method_id]['expression_instance'] = expr_instance catalog.filter_dict[method_id]['expression_instance'] = expr_instance
catalog.filter_dict[method_id]['type'] = type catalog.filter_dict[method_id]['type'] = filter_type
elif method_id in catalog.filter_dict.keys(): elif method_id in catalog.filter_dict.keys():
catalog.filter_dict[method_id]['filtered'] = 0 catalog.filter_dict[method_id]['filtered'] = 0
...@@ -1466,20 +1466,20 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -1466,20 +1466,20 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
method_list = xml.getElementsByTagName('item') method_list = xml.getElementsByTagName('item')
for method in method_list: for method in method_list:
key = method.getAttribute('key') key = method.getAttribute('key')
type = str(method.getAttribute('type')) key_type = str(method.getAttribute('type'))
if type == "str": if key_type == "str":
value = str(method.getElementsByTagName('value')[0].childNodes[0].data) value = str(method.getElementsByTagName('value')[0].childNodes[0].data)
key = str(key) key = str(key)
elif type == "int": elif key_type == "int":
value = int(method.getElementsByTagName('value')[0].childNodes[0].data) value = int(method.getElementsByTagName('value')[0].childNodes[0].data)
key = str(key) key = str(key)
elif type == "tuple": elif key_type == "tuple":
value = [] value = []
value_list = method.getElementsByTagName('value') value_list = method.getElementsByTagName('value')
for item in value_list: for item in value_list:
value.append(item.childNodes[0].data) value.append(item.childNodes[0].data)
else: else:
LOG('BusinessTemplate import CatalogMethod, type unknown', 0, type) LOG('BusinessTemplate import CatalogMethod, type unknown', 0, key_type)
continue continue
dict = getattr(self, key) dict = getattr(self, key)
dict[id] = value dict[id] = value
...@@ -1619,13 +1619,13 @@ class SitePropertyTemplateItem(BaseTemplateItem): ...@@ -1619,13 +1619,13 @@ class SitePropertyTemplateItem(BaseTemplateItem):
for property in p.propertyMap(): for property in p.propertyMap():
if property['id'] == id: if property['id'] == id:
obj = p.getProperty(id) obj = p.getProperty(id)
type = property['type'] prop_type = property['type']
break break
else: else:
obj = None obj = None
if obj is None: if obj is None:
raise NotFound, 'the property %s is not found' % id raise NotFound, 'the property %s is not found' % id
self._objects[id] = (type, obj) self._objects[id] = (prop_type, obj)
def _importFile(self, file_name, file): def _importFile(self, file_name, file):
# recreate list of site property from xml file # recreate list of site property from xml file
...@@ -1633,8 +1633,8 @@ class SitePropertyTemplateItem(BaseTemplateItem): ...@@ -1633,8 +1633,8 @@ class SitePropertyTemplateItem(BaseTemplateItem):
property_list = xml.getElementsByTagName('property') property_list = xml.getElementsByTagName('property')
for prop in property_list: for prop in property_list:
id = prop.getElementsByTagName('id')[0].childNodes[0].data id = prop.getElementsByTagName('id')[0].childNodes[0].data
type = prop.getElementsByTagName('type')[0].childNodes[0].data prop_type = prop.getElementsByTagName('type')[0].childNodes[0].data
if type in ('lines', 'tokens'): if prop_type in ('lines', 'tokens'):
value = [] value = []
values = prop.getElementsByTagName('value')[0] values = prop.getElementsByTagName('value')[0]
items = values.getElementsByTagName('item') items = values.getElementsByTagName('item')
...@@ -1643,7 +1643,7 @@ class SitePropertyTemplateItem(BaseTemplateItem): ...@@ -1643,7 +1643,7 @@ class SitePropertyTemplateItem(BaseTemplateItem):
value.append(str(i)) value.append(str(i))
else: else:
value = str(prop.getElementsByTagName('value')[0].childNodes[0].data) value = str(prop.getElementsByTagName('value')[0].childNodes[0].data)
self._objects[str(id)] = (str(type), value) self._objects[str(id)] = (str(prop_type), value)
def install(self, context, trashbin, **kw): def install(self, context, trashbin, **kw):
update_dict = kw.get('object_to_update') update_dict = kw.get('object_to_update')
...@@ -1659,8 +1659,8 @@ class SitePropertyTemplateItem(BaseTemplateItem): ...@@ -1659,8 +1659,8 @@ class SitePropertyTemplateItem(BaseTemplateItem):
dir, id = os.path.split(path) dir, id = os.path.split(path)
if p.hasProperty(id): if p.hasProperty(id):
continue continue
type, property = self._objects[path] prop_type, property = self._objects[path]
p._setProperty(id, property, type=type) p._setProperty(id, property, type=prop_type)
else: else:
BaseTemplateItem.install(self, context, trashbin, **kw) BaseTemplateItem.install(self, context, trashbin, **kw)
p = context.getPortalObject() p = context.getPortalObject()
...@@ -1686,11 +1686,11 @@ class SitePropertyTemplateItem(BaseTemplateItem): ...@@ -1686,11 +1686,11 @@ class SitePropertyTemplateItem(BaseTemplateItem):
def generateXml(self, path=None): def generateXml(self, path=None):
xml_data = '' xml_data = ''
type, obj = self._objects[path] prop_type, obj = self._objects[path]
xml_data += os.linesep+' <property>' xml_data += os.linesep+' <property>'
xml_data += os.linesep+' <id>%s</id>' %(path,) xml_data += os.linesep+' <id>%s</id>' %(path,)
xml_data += os.linesep+' <type>%s</type>' %(type,) xml_data += os.linesep+' <type>%s</type>' %(prop_type,)
if type in ('lines', 'tokens'): if prop_type in ('lines', 'tokens'):
xml_data += os.linesep+' <value>' xml_data += os.linesep+' <value>'
for item in obj: for item in obj:
if item != '': if item != '':
...@@ -3030,14 +3030,14 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -3030,14 +3030,14 @@ Business Template is a set of definitions, such as skins, portal types and categ
# export bt # export bt
bta.addFolder(path+os.sep+'bt') bta.addFolder(path+os.sep+'bt')
for prop in self.propertyMap(): for prop in self.propertyMap():
type = prop['type'] prop_type = prop['type']
id = prop['id'] id = prop['id']
if id in ('id', 'uid', 'rid', 'sid', 'id_group', 'last_id', 'install_object_list_list'): if id in ('id', 'uid', 'rid', 'sid', 'id_group', 'last_id', 'install_object_list_list'):
continue continue
value = self.getProperty(id) value = self.getProperty(id)
if type == 'text' or type == 'string' or type == 'int': if prop_type == 'text' or prop_type == 'string' or prop_type == 'int':
bta.addObject(obj=value, name=id, path=path+os.sep+'bt', ext='') bta.addObject(obj=value, name=id, path=path+os.sep+'bt', ext='')
elif type == 'lines' or type == 'tokens': elif prop_type == 'lines' or prop_type == 'tokens':
bta.addObject(obj=str(os.linesep).join(value), name=id, path=path+os.sep+'bt', ext='') bta.addObject(obj=str(os.linesep).join(value), name=id, path=path+os.sep+'bt', ext='')
# Export each part # Export each part
......
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