Commit e0825db8 authored by Romain Courteaud's avatar Romain Courteaud

Writing in the widget when rendering the field is a really bad idea.

So, do not use build_error_list anymore, and raise a real Error instead.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14879 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b7b0d91e
...@@ -63,6 +63,9 @@ from Products.CMFCore.utils import getToolByName ...@@ -63,6 +63,9 @@ from Products.CMFCore.utils import getToolByName
from Products.ERP5Type.Utils import getPath from Products.ERP5Type.Utils import getPath
from Products.ERP5Type.Message import Message from Products.ERP5Type.Message import Message
class PlanningBoxError(Exception):
pass
class PlanningBoxValidator(Validator.StringBaseValidator): class PlanningBoxValidator(Validator.StringBaseValidator):
""" """
Class holding all methods used to validate a modified PlanningBox Class holding all methods used to validate a modified PlanningBox
...@@ -521,9 +524,8 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -521,9 +524,8 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
value will not be updated (as the block was not on the real activity bound) value will not be updated (as the block was not on the real activity bound)
""" """
# getting list moved block names # getting list moved block names
block_moved_name_list = map(lambda x: x['block_moved']['name'], block_moved_name_list = [x['block_moved']['name'] for x in activity_block_moved_list]
activity_block_moved_list)
for activity_block in activity_block_list: for activity_block in activity_block_list:
if activity_block.name in block_moved_name_list: if activity_block.name in block_moved_name_list:
# the block composing the activity has been moved, not taking care of # the block composing the activity has been moved, not taking care of
...@@ -915,6 +917,7 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -915,6 +917,7 @@ class PlanningBoxWidget(Widget.Widget):
# build structure # build structure
# render_structure will call all method necessary to build the entire # render_structure will call all method necessary to build the entire
# structure relative to the planning # structure relative to the planning
# XXX Conflict error
# creates and fill up self.basic, self.planning and self.build_error_list # creates and fill up self.basic, self.planning and self.build_error_list
self.render_structure(field=field, key=key, value=value, self.render_structure(field=field, key=key, value=value,
REQUEST=REQUEST, here=here) REQUEST=REQUEST, here=here)
...@@ -958,8 +961,6 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -958,8 +961,6 @@ class PlanningBoxWidget(Widget.Widget):
# XXX testing : uncoment to put selection to null => used for debugging # XXX testing : uncoment to put selection to null => used for debugging
#here.portal_selections.setSelectionFor(selection_name, None) #here.portal_selections.setSelectionFor(selection_name, None)
####### DATA DEFINITION ####### ####### DATA DEFINITION #######
# XXX Conflict error
self.build_error_list = None
# recovering usefull planning properties # recovering usefull planning properties
# getting form # getting form
form = field.aq_parent form = field.aq_parent
...@@ -1002,8 +1003,7 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -1002,8 +1003,7 @@ class PlanningBoxWidget(Widget.Widget):
# call build method to generate BasicStructure # call build method to generate BasicStructure
status = self.basic.build() status = self.basic.build()
if status != 1: if status != 1:
# XXX Conflict error raise PlanningBoxError, status
self.build_error_list = status
return self return self
###### CALL CLASS METHODS TO BUILD PLANNING STRUCTURE ###### ###### CALL CLASS METHODS TO BUILD PLANNING STRUCTURE ######
...@@ -1015,8 +1015,7 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -1015,8 +1015,7 @@ class PlanningBoxWidget(Widget.Widget):
REQUEST=REQUEST) REQUEST=REQUEST)
if status != 1: if status != 1:
# in case error during planning structure generation # in case error during planning structure generation
# XXX Conflict error raise PlanningBoxError, status
self.build_error_list = status
return self return self
return self return self
......
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