Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Available actions #19

Open
alysivji opened this issue Sep 10, 2020 · 7 comments
Open

Available actions #19

alysivji opened this issue Sep 10, 2020 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@alysivji
Copy link
Owner

alysivji commented Sep 10, 2020

Given the current state, what actions are available?

@sammydowds
Copy link

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.

@alysivji
Copy link
Owner Author

alysivji commented Oct 7, 2020

That makes sense. I think we do something similar for functions where we store meta information in the .__fsm attribute

@alysivji
Copy link
Owner Author

alysivji commented Oct 7, 2020

Please take this one; would love the help!

@sammydowds
Copy link

Hello Aly, I might need some feedback on this. What is the best place to reach out to you?

@alysivji
Copy link
Owner Author

alysivji commented Oct 8, 2020

Can you create a pull request with your changes? Would make it easier to discuss

@sammydowds
Copy link

Ok! I opened one! Let me know if I am way off, or if this was not what you were looking for. #22

@alysivji alysivji added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Dec 8, 2020
@alysivji
Copy link
Owner Author

alysivji commented Oct 2, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants