-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
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.
There are two approaches I see:
- Changing the method signature:
-def transition_to_state(self, content, request, to_state, context=None, guards=(), skip_same=True):
+def transition_to_state(self, content, to_state, request=None, context=None, guards=(), skip_same=True):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_stateoptional too, and failing if it isNone:
-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?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels