Commit 21d26cfd authored by Rafael Monnerat's avatar Rafael Monnerat

Improve code style.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44833 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2adc6ba3
...@@ -30,8 +30,6 @@ from AccessControl import ClassSecurityInfo ...@@ -30,8 +30,6 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from zLOG import LOG, ERROR, DEBUG, WARNING
from Products.PageTemplates.Expressions import getEngine
from Products.ERP5Type.Accessor.Base import _evaluateTales from Products.ERP5Type.Accessor.Base import _evaluateTales
class Transition(XMLObject): class Transition(XMLObject):
...@@ -62,6 +60,7 @@ class Transition(XMLObject): ...@@ -62,6 +60,7 @@ class Transition(XMLObject):
""" """
Execute transition. Execute transition.
""" """
workflow = self.getParentValue()
# Call the before script # Call the before script
self._executeBeforeScript(document) self._executeBeforeScript(document)
...@@ -69,41 +68,38 @@ class Transition(XMLObject): ...@@ -69,41 +68,38 @@ class Transition(XMLObject):
self._changeState(document) self._changeState(document)
# Get variable values # Get variable values
status_dict = self.getParentValue().getCurrentStatusDict(document) status_dict = workflow.getCurrentStatusDict(document)
status_dict['undo'] = 0 status_dict['undo'] = 0
# Modify workflow history # Modify workflow history
state_bc_id = self.getParentValue().getStateBaseCategory() state_bc_id = workflow.getStateBaseCategory()
status_dict[state_bc_id] = document.getCategoryMembershipList(state_bc_id)[0] status_dict[state_bc_id] = document.getCategoryMembershipList(state_bc_id)[0]
state_object = document.unrestrictedTraverse(status_dict[state_bc_id]) state_object = document.unrestrictedTraverse(status_dict[state_bc_id])
object = self.getParentValue().getStateChangeInformation(document, state_object, transition=self) object = workflow.getStateChangeInformation(document, state_object, transition=self)
# Update all variables # Update all variables
variable_list = self.getParentValue().contentValues(portal_type='Variable') for variable in workflow.contentValues(portal_type='Variable'):
for variable in variable_list:
if variable.getAutomaticUpdate(): if variable.getAutomaticUpdate():
# if we have it in form get it from there # if we have it in form get it from there
# otherwise use default # otherwise use default
variable_title = variable.getTitle() variable_title = variable.getTitle()
if form_kw.has_key(variable_title): if variable_title in form_kw:
status_dict[variable_title] = form_kw[variable_title] status_dict[variable_title] = form_kw[variable_title]
else: else:
status_dict[variable_title] = variable.getInitialValue(object=object) status_dict[variable_title] = variable.getInitialValue(object=object)
# Update all transition variables # Update all transition variables
if form_kw is not None: if form_kw is not None:
object.REQUEST.other.update(form_kw) object.REQUEST.other.update(form_kw)
variable_list = self.contentValues(portal_type='Transition Variable') for variable in self.contentValues(portal_type='Transition Variable'):
for variable in variable_list:
status_dict[variable.getCausalityTitle()] = variable.getInitialValue(object=object) status_dict[variable.getCausalityTitle()] = variable.getInitialValue(object=object)
self.getParentValue()._updateWorkflowHistory(document, status_dict) workflow._updateWorkflowHistory(document, status_dict)
# Call the after script # Call the after script
self._executeAfterScript(document, form_kw=form_kw) self._executeAfterScript(document, form_kw=form_kw)
def _changeState(self, document): def _changeState(self, document):
""" """
Change the state of the object. Change the state of the object.
...@@ -147,5 +143,5 @@ class Transition(XMLObject): ...@@ -147,5 +143,5 @@ class Transition(XMLObject):
value = _evaluateTales(document, expr_value) value = _evaluateTales(document, expr_value)
else: else:
value = True value = True
#print "CALC", expr_value, '-->', value #print "CALC", expr_value, '-->', value
return value return value
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