The request object

clld registers a custom request factory, i.e. the request object available in view code or templates is an instance of clld.web.app.ClldRequest.

Page components

clld supports page components for web apps (i.e. parts of pages which require HTML code and JavaScript to define behavior) with the clld.web.util.component.Component virtual base class.

The design rationale for components is the idea to build the bridge between server and client as cleanly as possible by putting the code to collect options for a client side object and the instantiation of a these objects into one Python class (plus a mako template referenced in this class).

DataTables

DataTables are implemented as Python classes, providing configuration and server-side processing for jquery datatables.

Maps

Maps are implemented as subclasses of clld.web.maps.Map, providing configuration and server-side processing for leaflet maps.

The process for displaying a map is as follows:

  1. In python view code a map object is instantiated and made available to a mako template (either via the registry or directly, as template variable).
  2. In the mako template, the render method of the map is called, thus inserting HTML created from the template clld/web/templates/map.mako into the page.
  3. When the browser renders the page, CLLD.map() is called, instantiating a leaflet map object.
  4. During initialization of the leaflet map, for each clld.web.maps.Layer of the map a leaflet geoJson layer is instantiated, adding data to the map.
CLLD.map(eid, layers, options)
Arguments:
  • eid (string) – DOM element ID for the map object.
  • layers (array) – List of layer specifications.
  • options (object) – Map options.
Returns:

CLLD.Map instance.

Adapters