template¶
- class lucidity.template.Template(name, pattern, default_placeholder_expression='[\w_.\-]+?')[source]¶
Bases: object
A template.
- __init__(name, pattern, default_placeholder_expression='[\w_.\-]+?')[source]¶
Initialise with name and pattern.
- parse(path)[source]¶
Return dictionary of data extracted from path using this template.
Raise ParseError if path is not parseable by this template.
- format(data)[source]¶
Return a path formatted by applying data to this template.
Raise FormatError if data does not supply enough information to fill the template fields.