server/hooks.py
branch3.5
changeset 2985 79185b3ccf2c
parent 2983 b458631fe347
child 2992 a5b8bf107a1a
--- a/server/hooks.py	Tue Aug 25 13:35:45 2009 +0200
+++ b/server/hooks.py	Tue Aug 25 13:36:02 2009 +0200
@@ -515,6 +515,10 @@
                                                    state.eid)
 
 
+def set_initial_state_after_add(session, entity):
+    SetInitialStateOp(session, entity=entity)
+
+
 def before_add_in_state(session, eidfrom, rtype, eidto):
     """check state apply"""
     nocheck = session.transaction_data.setdefault('skip-security', ())
@@ -535,14 +539,13 @@
                         "want to set a custom workflow for this entity first.")
         raise ValidationError(eidfrom, {'in_state': msg})
 
-def set_initial_state_after_add(session, entity):
-    SetInitialStateOp(session, entity=entity)
-
 
 class WorkflowChangedOp(PreCommitOperation):
     """fix entity current state when changing its workflow"""
 
     def precommit_event(self):
+        # notice that enforcement that new workflow apply to the entity's type is
+        # done by schema rule, no need to check it here
         session = self.session
         pendingeids = session.transaction_data.get('pendingeids', ())
         if self.eid in pendingeids: