since we have the transition entity, give it directly stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 21 Sep 2009 18:09:38 +0200
branchstable
changeset 3350 fa77640a9155
parent 3349 cb610a404001
child 3351 2ea19d969a2d
since we have the transition entity, give it directly
selectors.py
web/views/workflow.py
--- a/selectors.py	Mon Sep 21 18:03:10 2009 +0200
+++ b/selectors.py	Mon Sep 21 18:09:38 2009 +0200
@@ -527,12 +527,10 @@
     @lltrace
     def __call__(self, cls, req, rset=None, row=None, col=0, **kwargs):
         try:
-            trname = req.execute('Any XN WHERE X is Transition, X eid %(x)s, X name XN',
-                                 {'x': typed_eid(req.form['treid'])})[0][0]
-        except (KeyError, IndexError):
-            return 0
-        # XXX check this is a transition that apply to the object?
-        if not trname in self.expected:
+            # XXX check this is a transition that apply to the object?
+            if not kwargs['transition'].name in self.expected:
+                return 0
+        except KeyError:
             return 0
         return 1
 
--- a/web/views/workflow.py	Mon Sep 21 18:03:10 2009 +0200
+++ b/web/views/workflow.py	Mon Sep 21 18:09:38 2009 +0200
@@ -64,7 +64,7 @@
         # not entity_implements) is used on custom form
         form = self.vreg['forms'].select(
             'changestate', self.req, rset=self.rset, row=row, col=col,
-            entity=entity, treid=transition.eid,
+            entity=entity, transition=transition,
             redirect_path=self.redirectpath(entity))
         self.w(form.error_message())
         self.w(u'<h4>%s %s</h4>\n' % (_(transition.name),