10.1.2. Class cerebro.aclasses.AbstractMessage

class cerebro.aclasses.AbstractMessage(event_id, message_id)[source]

Basic class of message. Provides basic functions to access message properties

Methods

DATA_ = ''

Message tuple fields

DATA_APPROVED_TIME = 8

Approved time to be signed off, minutes.

DATA_CREATED = 5

Time of message creation. Type - datetime.

DATA_CREATOR_ID = 13

ID of the user who created the message.

DATA_CREATOR_NAME = 4

Message author name.

DATA_FLAGS = 9

Message flags.

DATA_ID = 1

Message ID.

DATA_MODERATOR_ID = 14

ID of the user who modified the message.

DATA_MODERATOR_NAME = 10

Name of the user who modified the message.

DATA_MTM = 0

Time of data modification. Type - datetime.

DATA_PID = 2

Parent message ID.

DATA_TEXT = 7

Message text in html format.

DATA_TID = 11

ID of the task the message refers to.

DATA_TYPE = 3

Message type.

DATA_WORK_TIME = 6

Working time, minutes.

DATA_XMTM = 12

Real time of data modification. Type - datetime.

FLAG_ = ''

Message flags

FLAG_APPROVED = 1

The message is confirmed / approved (applicable to Report).

FLAG_CLIENT_VISIBLE = 0

The message is visible to clients.

TYPE_ = ''

Message types

TYPE_CLIENT_REVIEW = 4

Client Review.

TYPE_DEFINITION = 0

Definition.

TYPE_NOTE = 3

Note.

TYPE_REPORT = 2

Report.

TYPE_RESOURCE_REPORT = 5

Resource report.

TYPE_REVIEW = 1

Review.

TYPE_STATUS_CHANGES = 6

Message of change of the status of the task.

approved_time()[source]
Returns:working time approved to sign off, minutes. If the message type is Report or Resource Report, this is a working time approved to sign off. For all the rest message types returns 0.
Return type:int
hashtags()[source]
Returns:Returns list of hashtags.
Return type:list(string, )
is_approved()[source]
Returns:True, if message type is Report or Resource Report and it is marked as Approved. Such a Report/Resource Report has approved time equal to declared.
Return type:bool
if message.is_approved() == True:
        print('work_time == approved_time', message.work_time() == message.approved_time())                             
is_client_visible()[source]
Returns:True, if the message is marked as Visible to Clients.
Return type:bool
parent_message_id()[source]
Returns:parent message ID (Parent message is the message being replied by the current message). As a rule, message ID of Definitions is 0, it means Definitions have no parent messages.
Return type:int
if message.type() != message.TYPE_DEFINITION:
        parent_id = message.parent_message_id()
        print('Parent message', cerebro.core.message(parent_id).text_as_plain())                
posted_time()[source]
Returns:time of message creation.
Return type:datetime
task_id()[source]
Returns:Returns ID of the task the message refers to.
Return type:int
text_as_html()[source]
Returns:message text in html format.
Return type:string
text_as_plain()[source]
Returns:message text in plain text format.
Return type:string
type()[source]
Returns:message type.
Return type:int
if message.type() == message.TYPE_REPORT:
        print('Signed off working time', message.work_time())           
work_time()[source]
Returns:working time signed off in the message, minutes. If the message type is Report or Resource Report, this is a working time declared to sign off. If the message type is Review, this is a working time approved to sign off for the preceding Report or Resource Report. For all the rest message types returns 0.
Return type:int