10.6.19. Class cerebro.events.BeforeEventCreationOfTask

class cerebro.events.BeforeEventCreationOfTask(event_type, event_id)[source]

Bases: cerebro.events.Event, cerebro.aclasses.Task

The class for the task creation event. It grants access to the data of the new task before writing it into the database.

Methods

The class object is input into the functions before_event and error_event (in case of error) of the module event.

def before_event(event):        
        if event.event_type() == event.EVENT_CREATION_OF_TASK:
                ...
definition()[source]
Returns:a new message of the "Definition" type.
Return type:cerebro.events.BeforeEventCreationOfMessage

Alongside with creation of a new task, a new Definition message is being created also, that’s why the task creation event handles the Definition creation as well.

if event.event_type() == event.EVENT_CREATION_OF_TASK:
        message = event.definition()
        ...