websauna.system.core.vars module

Default template variables.

websauna.system.core.vars.debug(request, registry, settings)[source]

Invoke pdb breakpoint from a template.

Example:

<h1>{{ site_name }}</h1>

{{ debug() }}

This will invoke function from websauna.template_debugger setting. The debugger is turned on only on development.ini. If there is no debugger configured, a warning is given.

websauna.system.core.vars.includeme(config)[source]
websauna.system.core.vars.js_in_head(request, registry, settings)[source]

Should <script> tags be placed in <head> or end of <body>.

websauna.system.core.vars.on_demand_resource_renderer(request, registry, settings)[source]

Active instance of websauna.system.core.render.OnDemandResourceRenderer managing dynamic CSS and JS. May be None.

websauna.system.core.vars.site_author(request, registry, settings)[source]

Expose website URL from websauna.site_author config variable to templates.

This is used in footer to display the site owner.

websauna.system.core.vars.site_email_prefix(request, registry, settings)[source]

Expose website URL from websauna.site_email_prefix config variable to templates.

This is used as the subject prefix in outgoing email. E.g. if the value is SuperSite you’ll email subjects:

[SuperSite] Welcome to www.supersite.com
websauna.system.core.vars.site_name(request, registry, settings)[source]

Expose website name from websauna.site_name config variable to templates.

Example:

<div class="jumbotron text-center">
    <h1>{{ site_name }}</h1>
    <p class="lead text-center">
        {{ site_tag_line }}
    </p>
</div>
websauna.system.core.vars.site_tag_line(request, registry, settings)[source]

Expose website URL from websauna.site_tag_line config variable to templates.

This is used on the default front page to catch the attention of audience.

websauna.system.core.vars.site_time_zone(request, registry, settings)[source]

Expose website URL from websauna.site_time_zone config variable to templates.

By best practices, all dates and times should be stored in the database using UTC time. This setting allows quickly convert dates and times to your local time.

Example:

<p>
    <strong>Bar opens</strong>:
    {{ opening_at|friendly_time(timezone=site_time_zone) }}
</p>

Default value is UTC.

See timezone abbreviation list.

websauna.system.core.vars.site_title(request, registry, settings)[source]

Expose website name from websauna.site_title config variable to templates.

This is the default <title> tag.

Example:

<meta>
    <title>My page - {{ site_title }}</title>
</meta>
websauna.system.core.vars.site_url(request, registry, settings)[source]

Expose website URL from websauna.site_url config variable to templates.

Note

You should not use this variable in web page templates. This variable is intended for cases where one needs templating without running a web server.

The correct way to get the home URL of your website is:

<a href="{{ request.route_url('home') }}">Home</a>
websauna.system.core.vars.var(name)[source]

Decorator to mark template variables for documentation.