[Erp5-report] r24832 - /erp5/trunk/products/ERP5/Document/BusinessTemplate.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Dec 8 14:28:03 CET 2008
Author: jm
Date: Mon Dec 8 14:27:59 2008
New Revision: 24832
URL: http://svn.erp5.org?rev=24832&view=rev
Log:
Revert r24785 partially (Stop hiding modified workflow subobjects), because when the root object of a workflow is modified, the entire workflow is recreated: all subobjects are discarded and must be reinstalled.
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=24832&r1=24831&r2=24832&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] Mon Dec 8 14:27:59 2008
@@ -1304,6 +1304,23 @@
def __init__(self, id_list, tool_id='portal_workflow', **kw):
return ObjectTemplateItem.__init__(self, id_list, tool_id=tool_id, **kw)
+ # When the root object of a workflow is modified, the entire workflow is
+ # recreated: all subobjects are discarded and must be reinstalled.
+ # So we hide modified subobjects to the user and we always reinstall
+ # (or remove) everything.
+
+ def preinstall(self, context, installed_bt, **kw):
+ modified_object_dict = ObjectTemplateItem.preinstall(self, context,
+ installed_bt, **kw)
+ modified_workflow_dict = {}
+ for modified_object, state in modified_object_dict.iteritems():
+ path = modified_object.split('/')
+ if len(path) > 2:
+ modified_workflow_dict.setdefault(''.join(path[:2]), ('Modified', state[1]))
+ else:
+ modified_workflow_dict[modified_object] = state
+ return modified_workflow_dict
+
def install(self, context, trashbin, **kw):
if context.getTemplateFormatVersion() == 1:
portal = context.getPortalObject()
@@ -1314,7 +1331,7 @@
if force:
action = 'backup'
else:
- action = update_dict.get(path)
+ action = update_dict.get('/'.join(path.split('/')[:2]))
if action in (None, 'nothing'):
continue
container_path = path.split('/')[:-1]
More information about the Erp5-report
mailing list