def only_once(handler_id): """ Check if handler has already been run in the past. """ return not helpers.was_invoked(handler_id)
def wrapper(*args, **kwargs): action_id = _action_id(action) if not was_invoked(action_id): action(*args, **kwargs) mark_invoked(action_id)