Commit 2658125b authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: Must be able to really delete a Component and not only in 'deleted' state.

Folder_delete calls Workflow 'delete_action' if the object has any Workflow
History. Before, component_validation_workflow was acting like
validation_workflow for deleting objects, e.g. 'delete_action' triggers
'delete' state which is fine for normal documents but not Components.
parent 8d124bba
......@@ -52,7 +52,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Validation Workflow</string> </value>
<value> <string>Component Validation Workflow</string> </value>
</item>
</dictionary>
</pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>document = state_change[\'object\']\n
container = document.getParentValue()\n
container.manage_delObjects(ids=[document.getId()])\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>deleteObject</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Delete a document in ERP5</string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>delete</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string>deleted</string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Delete</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -10,6 +10,10 @@
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
......@@ -20,7 +24,7 @@
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>delete</string> </value>
<value> <string>deleteObject</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......
2013-06-26 arnaud.fontaine
* ZODB Components: Must be able to really delete a Component and not only in 'deleted' state. Folder_delete calls Workflow 'delete_action' if the object has any Workflow History. Before, component_validation_workflow was acting like validation_workflow for deleting objects, e.g. 'delete_action' triggers 'delete' state which is fine for normal documents but not Components.
2013-06-25 arnaud.fontaine
* ZODB Components: Migration must be all or nothing to avoid partial modifications of bt5 properties.
......
41101
\ No newline at end of file
41102
\ No newline at end of file
......@@ -1343,7 +1343,7 @@ class _TestZodbComponent(SecurityTestCase):
fromlist=[self._getComponentModuleName()],
level=0)
def testValidateInvalidate(self):
def testValidateInvalidateDelete(self):
"""
The new Component should only be in erp5.component.XXX when validated,
otherwise it should not be importable at all
......@@ -1364,6 +1364,17 @@ class _TestZodbComponent(SecurityTestCase):
self.tic()
self.assertModuleImportable('TestValidateInvalidateComponent')
test_component.invalidate()
self.tic()
self.failIfModuleImportable('TestValidateInvalidateComponent')
self.portal.portal_workflow.doActionFor(test_component, 'delete_action')
self.tic()
self.failIfModuleImportable('TestValidateInvalidateComponent')
self.assertEqual([o for o in self.portal.portal_components.contentValues()
if o.getReference() == 'TestValidateInvalidateComponent'],
[])
def testReferenceWithReservedKeywords(self):
"""
Check whether checkConsistency has been properly implemented for checking
......
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