safe.messaging.item.text module

InaSAFE Disaster risk assessment tool developed by AusAid - Paragraph.

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.item.text.PlainText(text, **kwargs)[source]

Bases: safe.messaging.item.text.Text

A class to model free text in the messaging system

We broke our ‘one class per file’ here because having it as a separate file was creating import problems due to a circular references.

to_html()[source]

Render as html

Args:
None
Returns:
Str the html representation
Raises:
Errors are propagated
to_text()[source]

Render as plain text

Args:
None
Returns:
Str the plain text representation
Raises:
Errors are propagated
class safe.messaging.item.text.Text(*args, **kwargs)[source]

Bases: safe.messaging.item.message_element.MessageElement

free text in the messaging with automatically added whitespaces

add(text)[source]

add a Text MessageElement to the existing Text

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

Parameters:text (str) – An element to add to the text.
to_html()[source]

Render a Text MessageElement as html.

Returns:Html representation of the Text MessageElement.
Return type:str
to_text()[source]

Render a Text MessageElement as plain text

Returns:Text representation of the Text MessageElement.
Return type:str