Commit b2ecb041 authored by Vincent Pelletier's avatar Vincent Pelletier

Improve _install method "pythonicity".

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19377 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent af6328ad
...@@ -4530,7 +4530,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4530,7 +4530,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
trashbin = None trashbin = None
# Install everything # Install everything
if len(object_to_update) > 0 or force: if len(object_to_update) or force:
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:
...@@ -4551,14 +4551,13 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4551,14 +4551,13 @@ Business Template is a set of definitions, such as skins, portal types and categ
# get objects to remove # get objects to remove
# do remove after because we may need backup object from installation # do remove after because we may need backup object from installation
remove_object_dict = {} remove_object_dict = {}
for path in object_to_update.keys(): for path, action in object_to_update.iteritems():
action = object_to_update[path] if action in ('remove', 'save_and_remove'):
if action == 'remove' or action == 'save_and_remove':
remove_object_dict[path] = action remove_object_dict[path] = action
object_to_update.pop(path) object_to_update.pop(path)
# remove object from old business template # remove object from old business template
if len(remove_object_dict) > 0: if len(remove_object_dict):
for item_name in installed_bt._item_name_list: for item_name in installed_bt._item_name_list:
item = getattr(installed_bt, item_name, None) item = getattr(installed_bt, item_name, None)
if item is not None: if item is not None:
......
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