fix match_transition selector: for instance w/ forge version change state form overiding, we want the form with the publication_date selected by the editcontroller, whatever the transition
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 10 Feb 2010 13:57:29 +0100
changeset 4545 9b7b3303c515
parent 4544 d92aa3221c30
child 4546 f8ac61376b2b
fix match_transition selector: for instance w/ forge version change state form overiding, we want the form with the publication_date selected by the editcontroller, whatever the transition
selectors.py
--- a/selectors.py	Wed Feb 10 12:00:37 2010 +0100
+++ b/selectors.py	Wed Feb 10 13:57:29 2010 +0100
@@ -1062,13 +1062,19 @@
 
 
 class match_transition(ExpectedValueSelector):
-    """Return 1 if a `transition` argument is found in the input context which
-    has a `.name` attribute matching one of the expected names given to the
-    initializer.
+    """Return 1 if:
+
+    * a `transition` argument is found in the input context which
+      has a `.name` attribute matching one of the expected names given to the
+      initializer
+
+    * no transition specified.
     """
     @lltrace
     def __call__(self, cls, req, transition=None, **kwargs):
         # XXX check this is a transition that apply to the object?
+        if transition is None:
+            return 1
         if transition is not None and getattr(transition, 'name', None) in self.expected:
             return 1
         return 0