Hello world#

This is a basic hello world module to build greetings either in plain text or html fragment.

class sample.hello.HelloBase(*args, name=None, **kwargs)[source]#

Bases: object

Basic hello world builder.

Keyword Arguments:

name (str) – Define a custom name to greet if given.

name#

Name to greet, default to world.

Type:

str

greet()[source]#

Return the greeting text.

Returns:

Complete greeting text with name.

Return type:

str

bye()[source]#

Unimplemented method for demonstration and test purpose around application exceptions.

Raises:

AppOperationError – A sample exception.

class sample.hello.HelloHTML(*args, **kwargs)[source]#

Bases: HelloBase

HTML hello world builder to surround greeting text with a HTML element.

Keyword Arguments:

container (str) – Define a custom HTML element name to use for container if given.

container#

HTML element name to use for container around text. Default to p for HTML paragraph.

Type:

str

greet()[source]#

Return the greeting text surrounded by HTML element container.

Returns:

Complete greeting text with name surrounded by container.

Return type:

str