-
-
Notifications
You must be signed in to change notification settings - Fork 98
Description
If you provide a domain model with a __bool__
method, that evaluates to False when constructing a a statemachine, the logic falls back to use the default model. If there are domain model conditions, then the StateMachine instantiation fails with an error like:
statemachine.exceptions.InvalidDefinition: Error on transition setup progress from Named to Dead when resolving callbacks: not found name 'spec_missing' from model or statemachine
Which doesn't provide any information to say the Domain Model is the default domain rather than the expected domain.
Probably, a StateMachine's __init__
should use model if model is not None else model()
rather than the implicit bool, or missing conditions/validations/callback errors should specify the type of the domain model so the user can see their model isn't being used.
Relevant line:
self.model = model if model else Model() |