Commit 63797b1e authored by Rafael Monnerat's avatar Rafael Monnerat

Just few style changes (make some lines shorter).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32333 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5efc17ae
...@@ -631,7 +631,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -631,7 +631,7 @@ class ObjectTemplateItem(BaseTemplateItem):
path = os.path.join(root_path, (os.sep).join(encode_folders)) path = os.path.join(root_path, (os.sep).join(encode_folders))
bta.addFolder(name=path) bta.addFolder(name=path)
# export object in xml # export object in xml
f=StringIO() f = StringIO()
XMLExportImport.exportXML(obj._p_jar, obj._p_oid, f) XMLExportImport.exportXML(obj._p_jar, obj._p_oid, f)
bta.addObject(obj=f.getvalue(), name=id, path=path) bta.addObject(obj=f.getvalue(), name=id, path=path)
...@@ -813,9 +813,13 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -813,9 +813,13 @@ class ObjectTemplateItem(BaseTemplateItem):
return subobjects_dict return subobjects_dict
# XXX btsave is for backward compatibility # XXX btsave is for backward compatibility
if action == 'backup' or action == 'btsave' or action == 'save_and_remove': if action == 'backup' or action == 'btsave' or action == 'save_and_remove':
subobjects_dict = self.portal_trash.backupObject(trashbin, container_path, object_id, save=1, **kw) subobjects_dict = self.portal_trash.backupObject(trashbin,
container_path, object_id,
save=1, **kw)
elif action == 'install': elif action == 'install':
subobjects_dict = self.portal_trash.backupObject(trashbin, container_path, object_id, save=0, **kw) subobjects_dict = self.portal_trash.backupObject(trashbin,
container_path, object_id,
save=0, **kw)
else: else:
# As the list of available actions is not strictly defined, # As the list of available actions is not strictly defined,
# prevent mistake if an action is not handled # prevent mistake if an action is not handled
...@@ -1458,8 +1462,9 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem): ...@@ -1458,8 +1462,9 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
root_path = os.path.join(bta.path, self.__class__.__name__) root_path = os.path.join(bta.path, self.__class__.__name__)
bta.addFolder(name=root_path) bta.addFolder(name=root_path)
# export workflow chain # export workflow chain
xml_data = self.generateXml() bta.addObject(obj=self.generateXml(),
bta.addObject(obj=xml_data, name='registered_skin_selection', path=root_path) name='registered_skin_selection',
path=root_path)
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')
...@@ -3065,7 +3070,8 @@ class ModuleTemplateItem(BaseTemplateItem): ...@@ -3065,7 +3070,8 @@ class ModuleTemplateItem(BaseTemplateItem):
try: try:
if trash and trashbin is not None: if trash and trashbin is not None:
container_path = key.split('/') container_path = key.split('/')
self.portal_trash.backupObject(trashbin, container_path, key, save=1, keep_subobjects=1) self.portal_trash.backupObject(trashbin, container_path,
key, save=1, keep_subobjects=1)
p.manage_delObjects([key]) p.manage_delObjects([key])
except NotFound: except NotFound:
pass pass
...@@ -4982,9 +4988,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4982,9 +4988,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
self.clean() self.clean()
self.updateRevisionNumber() self.updateRevisionNumber()
self._setTemplateFormatVersion(1) self._setTemplateFormatVersion(1)
self.storeTemplateItemData() self.storeTemplateItemData()
# Build each part # Build each part
...@@ -5058,7 +5062,8 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5058,7 +5062,8 @@ Business Template is a set of definitions, such as skins, portal types and categ
if installed_bt == self: if installed_bt == self:
reinstall = 1 reinstall = 1
if self.portal_templates._getOb(INSTALLED_BT_FOR_DIFF, None) is None: if self.portal_templates._getOb(INSTALLED_BT_FOR_DIFF, None) is None:
bt2 = self.portal_templates.manage_clone(ob=installed_bt, id=INSTALLED_BT_FOR_DIFF) bt2 = self.portal_templates.manage_clone(ob=installed_bt,
id=INSTALLED_BT_FOR_DIFF)
# update portal types properties to get last modifications # update portal types properties to get last modifications
bt2.getPortalTypesProperties() bt2.getPortalTypesProperties()
bt2.edit(description='tmp bt generated for diff', bt_for_diff=1) bt2.edit(description='tmp bt generated for diff', bt_for_diff=1)
...@@ -5085,7 +5090,8 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5085,7 +5090,8 @@ Business Template is a set of definitions, such as skins, portal types and categ
old_item = getattr(installed_bt, item_name, None) old_item = getattr(installed_bt, item_name, None)
if new_item is not None: if new_item is not None:
if old_item is not None and hasattr(old_item, '_objects'): if old_item is not None and hasattr(old_item, '_objects'):
modified_object = new_item.preinstall(context=self, installed_bt=old_item) modified_object = new_item.preinstall(context=self,
installed_bt=old_item)
if len(modified_object) > 0: if len(modified_object) > 0:
modified_object_list.update(modified_object) modified_object_list.update(modified_object)
else: else:
...@@ -5158,7 +5164,8 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5158,7 +5164,8 @@ Business Template is a set of definitions, such as skins, portal types and categ
for item_name in self._item_name_list: for item_name in self._item_name_list:
item = getattr(self, item_name, None) item = getattr(self, item_name, None)
if item is not None: if item is not None:
item.install(self, force=force, object_to_update=object_to_update, trashbin=trashbin, installed_bt=installed_bt) item.install(self, force=force, object_to_update=object_to_update,
trashbin=trashbin, installed_bt=installed_bt)
# update catalog if necessary # update catalog if necessary
if force and self.isCatalogUpdatable(): if force and self.isCatalogUpdatable():
......
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