Welcome to Gizmo(QP)

Gizmo(QP) is an extension of the QP Web Framework, aiming to make interface-rich web applications more manageable.

Menu
  • Home
  • Documentation
    • Hello World
    • Hello Pluto
    • Dhi 
    • Gizmos
    • Gizmo Form
    • Unburdened Page
    • Access Control
    • Templating
    • Site Configuration
  • Demo
  • Download

Templating

Gizmo(QP) Templating

A Templating, or Skin, is a manager of a related set of templates — it defines page templates, in accordance with its own meaning of what a page template is, and manages their invocation. To respond, an export (that is a web accessible object or method, in QP parlance) need only call gz.pub.common.page(), that will cause the site’s templating to delegate the generation of the formatted page to the right page template.

At initialization, the Publisher.skin attribute is set with a newly created templating instance, as returned byPublisher.skin_class(). There is an abstract base Skin class, on which concrete Skins are based. Currently, Gizmo(QP) offers two predefined Skins.

The first, QpySkin, is directly based on the Qpy Unicode Templating package, that provides a convenient mechanism for generating safely-quoted html text from python code.

The other is EvoqueTemplating and provides the necessary integration between Gizmo(QP) and the full-featured Evoque Templating engine.

To create another kind of Skin altogether, such as one that defines another kind of template, or uses a different templating package, you subclass the base Skin class.

Clean HTML output

To make complex dhtml pages easier to manage, a page may make use of a dhi instance, to which complex page objects such as gizmos can contribute to. The base Skin class takes care of dhi rendering, also making sure that it is rendered last — so that it can be contributed to at any time during page generation.

As a consequence, the dhtml rendering of a page that uses a dhi instance has a maximum of one inlined script tagand has a maximum of one inlined style tag. This makes such complex pages easier to debug as well as simpler to render by the client.

Default renderers

Default implementations for some frequently needed renderers are provided as stand-alone modules. Callables from these are exposed to the template evaluation namespace, under the namespaces site, page, gizmo, html. Examples include page.crumbs(), page.menu(), page.crumbed_menu(), site.link_login(), site.link_logout(),site.link_register(), etc.

More Information

  • the Comprehensive Demo
  • the package: gz.skin

Categories

  • Data
  • Uncategorized
  • Writing Help

Archives

  • January 2023
  • September 2022
  • July 2022
  • May 2022
  • December 2021
  • February 2020
  • January 2020
  • November 2019
  • September 2019
  • June 2019
  • April 2019
  • March 2019
February 2023
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
2728  

© Welcome to Gizmo(QP) 2023. Powered by WordPress