stevedore/stevedore/example/simple.py
Doug Hellmann fd4e42f0fe Add tutorial section on creating plugins
Expand and reorg the naming discussion.

Add a section on the mechanics of creating plugins,
with some tested example code.

Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
2013-06-05 17:11:23 -04:00

21 lines
526 B
Python

from stevedore.example import base
class Simple(base.FormatterBase):
"""A very basic formatter.
"""
def format(self, data):
"""Format the data and return unicode text.
:param data: A dictionary with string keys and simple types as
values.
:type data: dict(str:?)
"""
for name, value in sorted(data.items()):
line = '{name} = {value}\n'.format(
name=name,
value=value,
)
yield line