Open alysivji opened 4 years ago
Hello Aly, I would also like to take this on. I am thinking I could add an attribute to the StateMachine class for transitions which would be a dictionary of transitions, and then add some methods to return available transitions based on sources and targets.
It looks like they do something similar with FSMMeta in django-fsm in this file.
That makes sense. I think we do something similar for functions where we store meta information in the .__fsm
attribute
Please take this one; would love the help!
Hello Aly, I might need some feedback on this. What is the best place to reach out to you?
Can you create a pull request with your changes? Would make it easier to discuss
Ok! I opened one! Let me know if I am way off, or if this was not what you were looking for. #22
I think the way to do this is to change the transition
from being a function decorator to being decorator created via a class with class level variables:
class TransitionDecorator:
transition_mapping = {}
def __init__(self):
pass
def __call__(self, *args, *kwargs):
# return a decorator
# when creating decorator, add elements to use self.__class__.transition_mapping
Class will allow us to have state saved. Need to figure out how to access this mapping from the state machine sub-class
Given the current state, what actions are available?