Commit 4e9da49e authored by Arnaud Fontaine's avatar Arnaud Fontaine

Use existing error_message workflow variable of component_validation_workflow.

Before, ConsistencyMessage were stored into a separate workflow variable,
instead of using error_message workflow variable which contains instances of
Message.
parent 0b3fdb3f
......@@ -56,6 +56,14 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
......@@ -70,10 +78,18 @@
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -127,7 +143,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getValidationState() == \'modified\'</string> </value>
<value> <string>here/hasErrorMessageList</string> </value>
</item>
</dictionary>
</pickle>
......
2012-02-29 arnaud.fontaine
* Display error messages in Component_view which may have been raised when validating a Component in draft state.
2012-02-29 arnaud.fontaine
* Add portal_components to keep path list.
......
41018
\ No newline at end of file
41019
\ No newline at end of file
......@@ -239,13 +239,29 @@ class ComponentMixin(PropertyRecordableMixin, Base):
error_list = self.checkConsistency()
if error_list:
workflow = self.workflow_history['component_validation_workflow'][-1]
workflow['error_list'] = error_list
# When checking consistency with validate_action, messages are stored
# into error_message workflow attribute as Message instances
workflow['error_message'] = [error.getMessage() for error in error_list]
else:
for property_name in self._recorded_property_name_tuple:
self.clearRecordedProperty(property_name)
self.validate()
security.declareProtected(Permissions.AccessContentsInformation,
'getErrorMessageList')
def hasErrorMessageList(self):
"""
Check whether there are error messages, useful to display errors in the UI
without calling getErrorMessageList() which translates error messages
"""
try:
self.workflow_history['component_validation_workflow'][-1]['error_message']
return True
except KeyError:
return False
security.declareProtected(Permissions.AccessContentsInformation,
'getErrorMessageList')
def getErrorMessageList(self):
......@@ -254,8 +270,8 @@ class ComponentMixin(PropertyRecordableMixin, Base):
the Component has been modified after being validated once
"""
current_workflow = self.workflow_history['component_validation_workflow'][-1]
return [str(error.getTranslatedMessage())
for error in current_workflow.get('error_list', [])]
return [error.translate()
for error in current_workflow.get('error_message', [])]
security.declareProtected(Permissions.ModifyPortalContent, 'load')
def load(self, namespace_dict={}, validated_only=False, text_content=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