[selector] update `match_transition` selector to match form & as well as form view. stable
authorCharles Hébert <charles.hebert@logilab.fr>
Mon, 24 Jan 2011 16:59:26 +0100
branchstable
changeset 6881 a473bf557456
parent 6880 4be32427b2b9
child 6882 b5e34836f84e
child 6885 ea4baa1d16d6
[selector] update `match_transition` selector to match form & as well as form view.
selectors.py
--- a/selectors.py	Mon Jan 24 11:39:53 2011 +0100
+++ b/selectors.py	Mon Jan 24 16:59:26 2011 +0100
@@ -1438,6 +1438,10 @@
     @lltrace
     def __call__(self, cls, req, transition=None, **kwargs):
         # XXX check this is a transition that apply to the object?
+        if transition is None:
+            treid = req.form.get('treid', None)
+            if treid:
+                transition = req.entity_from_eid(treid)
         if transition is not None and getattr(transition, 'name', None) in self.expected:
             return 1
         return 0