gws.base.template.core¶
Base template object.
Source code: gws.base.template.core
Module Contents¶
- class gws.base.template.core.Config(*args, **kwargs)¶
Bases:
gws.ConfigWithAccessTemplate configuration.
- mapSize: gws.UomSizeStr | None¶
Size of the map on the page.
- mimeTypes: list[gws.MimeType] | None¶
Output MIME types of the template.
- pageMargin: gws.UomExtentStr | None¶
Page margins in the order top, right, bottom, left.
- pageSize: gws.UomSizeStr | None¶
Page size.
- gws.base.template.core.DEFAULT_MAP_SIZE¶
- gws.base.template.core.DEFAULT_PAGE_SIZE¶
- class gws.base.template.core.Object¶
Bases:
gws.TemplateBase class for templates.
Reads the common template options: subject, title, output MIME types, page size, map size and page margins. Subclasses implement rendering; they can use
prepare_argsto build the template arguments with the locale, formatters and localized strings, andnotifyto report progress.- configure()¶
Configuration hook.
Called when the node is initialized. Raising an exception here aborts the creation of the node.
- notify(tri: gws.TemplateRenderInput, message: str)¶
Send a progress message to the
notifycallback of the render input, if any.- Parameters:
tri – Template render input.
message – Progress message, like
begin_print.
- prepare_args(tri: gws.TemplateRenderInput) gws.TemplateArgs¶
Build the template arguments from the render input.
Adds
app,subject,locale, thedate,timeandnumberformatters, the obsoletegwsVersionandgwsBaseUrl, unless already given intri.args. The locale is taken from the arguments, the render input, the first application locale or the default locale.STRINGSis set to the default strings for the locale language, updated with the givenSTRINGS.- Parameters:
tri – Template render input.
- Returns:
Template arguments.
- props(user)¶
Generate a
Propsstruct for this object.Do not call this method directly, use
gws.props_ofinstead, which also checks permissions.- Parameters:
user – The user for which the props should be generated.
- Returns:
A
Propsobject or a dict. Nested objects are converted to props as well.