safe.messaging.message module

InaSAFE Disaster risk assessment tool developed by AusAid - Message Modele.

Contact : ole.moller.nielsen@gmail.com

Note

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

class safe.messaging.message.Message(*args, **kwargs)[source]

Bases: safe.messaging.item.message_element.MessageElement

Message object to contain a list of MessageElements

add(message)[source]

add a MessageElement to the queue

Strings can be passed and are automatically converted in to item.Text()

Parameters:message (Message, MessageElement, str) – An element to add to the message queue.
clear()[source]

clear MessageElement queue

Args:
None
Returns:
None
Raises:
Errors are propagated
to_html(suppress_newlines=False, in_div_flag=False)[source]

Render a MessageElement as html.

Parameters:
  • suppress_newlines (bool) – Whether to suppress any newlines in the output. If this option is enabled, the entire html output will be rendered on a single line.
  • in_div_flag (bool) – Whether the message should be placed into an outer div element.
Returns:

HTML representation of the message.

Return type:

str

to_text()[source]

Render a MessageElement queue as plain text.

Returns:Plain text representation of the message.
Return type:str