Ian George  committed 1f57e77

field name now populated in declarative metaclass

  • Participants
  • Parent commits 18a68f4
  • Branches default

Comments (0)

Files changed (1)

File statemachine/

     states = [(state_name, attrs.pop(state_name)) for state_name, obj in attrs.items() if isinstance(obj, State)]
+    for name, state in states:
+ = name
     states.sort(key=lambda x: x[1].creation_counter)
     # If this class is subclassing another StateMachine, add that StateMachine's states.
     def getstate(self):
         return self.__state
     def setstate(self, value):
         raise FSM_NotAllowed("State is read only, please use change() to change state")
     state = property(getstate, setstate)
     def set_initial_state(self, state):
         self.__state = state
+    def available_states(self):
+        return [self.states[s] for s in self.states[self.__state].exit_states]
     def verify(self):