Skip to content

dispatch short-circuiting is confusing #701

Description

@Joshuaalbert

What's the value of short-circuiting in dispatch? The point of dispatch is to call the trigger in a many-models-single-machine situation. I don't want the arbitrary ordering of the models to affect whether some models are allowed to trigger. I think this is a bug, but if not can someone explain to me the design choice?

    def dispatch(self, trigger, *args, **kwargs):
        """Trigger an event on all models assigned to the machine.
        Args:
            trigger (str): Event name
            *args (list): List of arguments passed to the event trigger
            **kwargs (dict): Dictionary of keyword arguments passed to the event trigger
        Returns:
            bool The truth value of all triggers combined with AND
        """
        return all(getattr(model, trigger)(*args, **kwargs) for model in self.models)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions