gws.base.template.manager¶
Template manager.
Source code: gws.base.template.manager
Module Contents¶
- class gws.base.template.manager.Object¶
Bases:
gws.TemplateManagerTemplate manager.
- find_template(subject, where, user=None, mime_type=None)¶
Find a template for a subject.
The templates of the objects in
whereare searched in the given order, then the application templates. A template withoutmimeTypesmatches any MIME type.- Parameters:
subject – Template subject.
where – Objects whose templates are searched, in this order.
user – If given, only templates this user can use.
mime_type – If given, only templates which can produce this MIME type.
- Returns:
The first matching template, or
None.
- find_templates(subjects, where, user=None, mime_type=None)¶
Find templates for several subjects.
- Parameters:
subjects – Template subjects.
where – Objects whose templates are searched, in this order.
user – If given, only templates this user can use.
mime_type – If given, only templates which can produce this MIME type.
- Returns:
Found templates, one per subject at most.
- template_from_path(path, **kwargs)¶
Create a template from a file.
The template type is derived from the file extension.
- Parameters:
path – File path.
- Returns:
A template, or
Noneif the file is not a template.
- gws.base.template.manager.TEMPLATE_TYPES¶