You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The transition_to_state() method is more or less just a permissions wrapper around the _transition_to_state() method that does the bulk of the work.
The _transition_to_state() has the request parameter optional, while the transition_to_state() does not. I'd like to make the request parameter optional also in transition_to_state() so that I don't have to pass None in application code that does not use the permissions checker.
But this is backwards incompatible and is likely gonna break application code that relies on positioning of to_state and request parameters in transition_to_state() method.
Making to_state optional too, and failing if it is None:
-def transition_to_state(self, content, request, to_state, context=None, guards=(), skip_same=True):+def transition_to_state(self, content, request=None, to_state=None, context=None, guards=(), skip_same=True):+ if not to_state:+ raise KeyError('"to_state" is a required parameter')
Which approach is better? Suggestions for tackling this issue some other way?
The text was updated successfully, but these errors were encountered:
zupo
changed the title
Make request optional in transition_to_state()
Make request optional in transition_to_state()
Nov 6, 2015
The
transition_to_state()
method is more or less just a permissions wrapper around the_transition_to_state()
method that does the bulk of the work.The
_transition_to_state()
has therequest
parameter optional, while thetransition_to_state()
does not. I'd like to make therequest
parameter optional also intransition_to_state()
so that I don't have to passNone
in application code that does not use the permissions checker.There are two approaches I see:
But this is backwards incompatible and is likely gonna break application code that relies on positioning of
to_state
andrequest
parameters intransition_to_state()
method.to_state
optional too, and failing if it isNone
:Which approach is better? Suggestions for tackling this issue some other way?
The text was updated successfully, but these errors were encountered: