Commit d5f978df authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: Source code and consistency were not checked during import from FS.

These are done through 'validate_action' not at 'validate' Workflow transition.

text_content_{error,warning}_message_list was properly set through
Component_modify Interaction (used for editing Component) which checks the
source code without raising an exception.

XXX-BEFORE-MERGE: Unit Test.
parent 7bdebea8
......@@ -367,10 +367,20 @@ class ComponentMixin(PropertyRecordableMixin, Base):
text_content=source_code,
portal_type=cls.portal_type)
# Validate the Component once it is imported so it can be used
# straightaway as there should be no error
new_component.validate()
# XXX-ARNAU: checkConsistency() is also called before commit in
# Component_checkSourceCodeAndValidateAfterModified. Also, everything
# should be done in checkConsistency()...
error_message_list = [ m for m in new_component.checkSourceCode()
if m['type'] == 'E' ]
if error_message_list:
raise SyntaxError(error_message_list)
consistency_message_list = new_component.checkConsistency()
if consistency_message_list:
from Products.DCWorkflow.DCWorkflow import ValidationFailed
raise ValidationFailed(consistency_message_list)
new_component.validate()
return new_component
InitializeClass(ComponentMixin)
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