[Erp5-report] r19377 - /erp5/trunk/products/ERP5/Document/BusinessTemplate.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Feb 19 10:23:36 CET 2008
Author: vincent
Date: Tue Feb 19 10:23:36 2008
New Revision: 19377
URL: http://svn.erp5.org?rev=19377&view=rev
Log:
Improve _install method "pythonicity".
Modified:
erp5/trunk/products/ERP5/Document/BusinessTemplate.py
Modified: erp5/trunk/products/ERP5/Document/BusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessTemplate.py?rev=19377&r1=19376&r2=19377&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py Tue Feb 19 10:23:36 2008
@@ -4530,7 +4530,7 @@
trashbin = None
# 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:
item = getattr(self, item_name, None)
if item is not None:
@@ -4551,14 +4551,13 @@
# get objects to remove
# do remove after because we may need backup object from installation
remove_object_dict = {}
- for path in object_to_update.keys():
- action = object_to_update[path]
- if action == 'remove' or action == 'save_and_remove':
+ for path, action in object_to_update.iteritems():
+ if action in ('remove', 'save_and_remove'):
remove_object_dict[path] = action
object_to_update.pop(path)
# 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:
item = getattr(installed_bt, item_name, None)
if item is not None:
More information about the Erp5-report
mailing list