10.6.17. Class cerebro.events.BeforeEventChangingOfTasksTag

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

Bases: cerebro.events.BeforeEventChangingOfTasks

The class for the tag value altering event - for a single or for multiple task(s). It grants access to the data of the modified tasks before writing it into the database.


Tags in Cerebro are used as additional task properties. A tag, being allocated to a project, becomes a task property automatically. The tags aquire values in the process of working on the tasks.


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_CHANGING_OF_TASKS_TAG:
Returns:True, if the tag type is "multi enum" and the elements are being added to the tag value. Otherwise it is False.
Return type:bool

In case of adding elements to the tag value the method new_value() returns a list of the elements being added. Otherwise, it returns a list of elements being removed.

In order to change the list of elements being added/removed, use the method set_new_value(). The input argument type for this method - list(tag_element_id,), a list of the tag element IDs.

def before_event(event):        
        if event.event_type() == event.EVENT_CHANGING_OF_TASKS_TAG: # changing the activity type
                if event.tag().type() == event.tag().TYPE_MULTI_ENUM and event.is_added_elements():
                        print('The tag elements being added', event.new_value())                                        
Returns:the tag undergoing modification.
Return type:cerebro.aclasses.AbstractTag