From 21d26cfdee1f5123d9e564466ad7af2624b306b1 Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Thu, 31 Mar 2011 00:35:01 +0000
Subject: [PATCH] Improve code style.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44833 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Workflow/Document/Transition.py | 28 +++++++++------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/product/ERP5Workflow/Document/Transition.py b/product/ERP5Workflow/Document/Transition.py
index 797cd9f51d..5d7cd1d2d7 100644
--- a/product/ERP5Workflow/Document/Transition.py
+++ b/product/ERP5Workflow/Document/Transition.py
@@ -30,8 +30,6 @@ from AccessControl import ClassSecurityInfo
 
 from Products.ERP5Type import Permissions, PropertySheet
 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
 
 class Transition(XMLObject):
@@ -62,6 +60,7 @@ class Transition(XMLObject):
     """
     Execute transition.
     """
+    workflow = self.getParentValue()
     # Call the before script
     self._executeBeforeScript(document)
 
@@ -69,41 +68,38 @@ class Transition(XMLObject):
     self._changeState(document)
 
     # Get variable values
-    status_dict = self.getParentValue().getCurrentStatusDict(document)
+    status_dict = workflow.getCurrentStatusDict(document)
     status_dict['undo'] = 0
 
     # 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]
 
     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
-    variable_list = self.getParentValue().contentValues(portal_type='Variable')
-    for variable in variable_list:
+    for variable in workflow.contentValues(portal_type='Variable'):
       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
         variable_title = variable.getTitle()
-        if form_kw.has_key(variable_title):
-           status_dict[variable_title] = form_kw[variable_title] 
+        if variable_title in form_kw:
+           status_dict[variable_title] = form_kw[variable_title]
         else:
           status_dict[variable_title] = variable.getInitialValue(object=object)
 
     # Update all transition variables
     if form_kw is not None:
       object.REQUEST.other.update(form_kw)
-    variable_list = self.contentValues(portal_type='Transition Variable')
-    for variable in variable_list:
+    for variable in self.contentValues(portal_type='Transition Variable'):
       status_dict[variable.getCausalityTitle()] = variable.getInitialValue(object=object)
-        
-    self.getParentValue()._updateWorkflowHistory(document, status_dict)
+
+    workflow._updateWorkflowHistory(document, status_dict)
 
     # Call the after script
     self._executeAfterScript(document, form_kw=form_kw)
 
-
   def _changeState(self, document):
     """
     Change the state of the object.
@@ -147,5 +143,5 @@ class Transition(XMLObject):
       value = _evaluateTales(document, expr_value)
     else:
       value = True
-    #print "CALC", expr_value, '-->', value 
+    #print "CALC", expr_value, '-->', value
     return value
-- 
2.30.9