DocTablesInternals

Here are some notes on table internals

classes [edit section]

table_class [edit section]

A table consist of a instance of table_class with the following attributes:

table_conf_class [edit section]

Has all kinds of configuration information (the raw text) for a class:

methods:

The base conf is read from a block on the page, and the dynamic conf is read from the URL. This allows things like a base configuration specifying the field types, while the dynamic conf specifies the sortby order (or some other complex query, like from a query form.

table_class methods:

form_fields_generator_class [edit section]

The form_fields_generator_class is used to create an instance of a form_fields_generator. This is used with a form_spec to create an actual form. It generates the correct HTML for each field, on the fly, by acting like a map where the string substitutions in the form get converted into appropriate HTML input elements.

io_handle_* classes [edit section]

These classes handle I/O operations for the different types of databases supported:

An io_handler instance has the following attributes:

The io_handle_base class is a stub class, with methods for:

Different classes implement these methods, according to the database type.

class capture_stderr [edit section]

In order to capture errors, a class is used to grab the errors and put them in a buffer. This is to capture exceptions and put them in the message log, in case of unhandled error conditions.

global routines [edit section]

Table Processor [edit section]

The table processor has the following actions:

Notes [edit section]

A table configuration can have the following attributes:

The conf and query lines can "chain" to other blocks, so that a multiple "Views" can be constructed from the same data.

For example, a table could be defined like:

{{ {Data
||foo||bar||baz||
||1  ||yes ||5||
||3  ||no  ||100||

}} }

{{ {#Conf1
source_spec=#:Data
sortby=bar,int
field=bar
possible_values="""yes
no"""
field=baz
color_list="""(int(value))<50:red
(int(value)<100:yellow"""
}} }

{{ {#Query1
col_list=foo,baz
filter=foo=1
}} }

{{ {!#Table
conf=#:Conf1
query=#:Query1
}} }

source_specs indicate the source and type of data for the database:

sortby can have the following types: