[wf] new .workflow property on states and transitions 3.5
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 25 Aug 2009 12:32:44 +0200
branch3.5
changeset 2975 fed52d317ba7
parent 2974 3dfe497e5afa
child 2976 d01417c14f35
[wf] new .workflow property on states and transitions
entities/wfobjs.py
--- a/entities/wfobjs.py	Tue Aug 25 11:47:26 2009 +0200
+++ b/entities/wfobjs.py	Tue Aug 25 12:32:44 2009 +0200
@@ -128,6 +128,10 @@
             raise Exception('should not be instantiated')
         super(BaseTransition, self).__init__(*args, **kwargs)
 
+    @property
+    def workflow(self):
+        return self.transition_of[0]
+
     def may_be_fired(self, eid):
         """return true if the logged user may fire this transition
 
@@ -218,6 +222,10 @@
     fetch_attrs, fetch_order = fetch_config(['name'])
     rest_attr = 'eid'
 
+    @property
+    def workflow(self):
+        return self.state_of[0]
+
     def after_deletion_path(self):
         """return (path, parameters) which should be used as redirect
         information when this entity is being deleted