selectors.py
branchstable
changeset 7298 a448e470c150
parent 7297 117dbb11a42e
child 7345 b9eaad6e34c3
--- a/selectors.py	Mon May 02 17:24:51 2011 +0200
+++ b/selectors.py	Tue May 03 11:02:32 2011 +0200
@@ -1244,9 +1244,10 @@
     :class:`cubicweb.entities.wfobjs.TrInfo` for more information.
     """
     def match_etype_and_transition(trinfo):
-        # is_instance() first two arguments are 'cls' (unused, so giving None is
-        # fine) and the request/session
-        return (trinfo.transition.name == tr_name
+        # take care trinfo.transition is None when calling change_state
+        return (trinfo.transition and trinfo.transition.name == tr_name
+                # is_instance() first two arguments are 'cls' (unused, so giving
+                # None is fine) and the request/session
                 and is_instance(etype)(None, trinfo._cw, entity=trinfo.for_entity))
 
     return is_instance('TrInfo') & score_entity(match_etype_and_transition)