FrontPage 

TB Wiki

Login

Regression Test

Expected HTML for page "DocTablesInternals"


expected html
nothing
t1Here are some notes on table internalst
2<p>
3 
4<table align="right"><tr><td><div class="toc">
5Contents:
6<ul>
7  <li><a href="#classes">classes</a></li>
8  <ul>
9    <li><a href="#table_class">table_class</a></li>
10    <ul>
11      <li><a href="#table_conf_class">table_conf_class</a></li>
12    </ul>
13    <li><a href="#form_fields_generator_class">form_fields_generator_class</a></li>
14    <li><a href="#io_handle_*_classes">io_handle_*&nbsp;classes</a></li>
15    <li><a href="#class_capture_stderr">class&nbsp;capture_stderr</a></li>
16  </ul>
17  <li><a href="#global_routines">global&nbsp;routines</a></li>
18  <li><a href="#Table_Processor">Table&nbsp;Processor</a></li>
19  <li><a href="#Notes">Notes</a></li>
20</ul>
21</div></td></tr></table>
22<p>
23<h1><a name="classes">classes</a>
24<span align=right class="section_edit_link">[<a href="/tbwiki/DocTablesInternals?action=edit&section=classes">edit section</a>]</font></span>
25</h1>
26<h2><a name="table_class">table_class</a>
27<span align=right class="section_edit_link">[<a href="/tbwiki/DocTablesInternals?action=edit&section=table_class">edit section</a>]</font></span>
28</h2>
29A table consist of a instance of table_class with the following attributes:
30<ul><li>.records - a map of actual records of the database
31<li>header_record - a record with header values for the fields
32<li>.source_spec - indicates the origin of the data
33<li>.field_list - a list of records containing information about the fields in the db
34<li>col_names - a map of column names
35<li>row_names - a map of row names
36<li>row_output_list - list of record_ids for rows to show
37<li>row_filter -
38<li>col_output_list - list of col_names for columns to show
39<li>page_name
40<li>conf
41<li>rmap
42<li>num_fields
43<li>message - a message to print out, for debugging or errors
44<li>conf - the database configuration
45<ul><li>see below
46</ul><li>handler - the io handler for the database
47<ul><li>see below
48</ul><li>req = the request that fetched this database
49<li>data_dir = the directory where the data was read from (e.g. data or admin or backup)
50</ul>
51<p>
52<h3><a name="table_conf_class">table_conf_class</a>
53<span align=right class="section_edit_link">[<a href="/tbwiki/DocTablesInternals?action=edit&section=table_conf_class">edit section</a>]</font></span>
54</h3>
55Has all kinds of configuration information (the raw text) for a class:
56<ul><li>conf_spec
57<li>source_spec
58<li>row_filter
59<li>cols
60<li>sortby
61<li>row_output_list
62<li>query
63<li>query_list
64<li>sort_col_list
65<li>add_form
66<li>edit_form
67<li>show_header
68<li>show_record
69<li>show_footer
70<li>field_spec
71<li>field_db - map of attributes for the fields in the database
72<ul><li>a field_db element (field record) can have the following attributes:
73<ul><li>type
74<li>possible_values
75<li>color_list
76</ul>
77</ul>
78</ul>
79<p>
80methods:
81<ul><li>__init__
82<li>set_color_lists
83<li>get_conf - get the configuration.  This is a merge of the base conf and the dynamic conf
84 *
85</ul>
86<p>
87The base conf is read from a block on the page, and the dynamic conf is read
88from the URL.  This allows things like a base configuration specifying the
89field types, while the dynamic conf specifies the sortby order (or some other complex query, like from a query form.
90<p>
91table_class methods:
92<p>
93<ul><li>__init__
94<li>add_or_edit_numbered_record
95<li>remove_numbered_record
96<li>set_col_output_list
97<li>set_row_filter
98<li>filter_match
99<li>add_to_message
100<li>html_string - main routine to render the table to HTML
101<li>get_default_edit_form_spec
102<li>show_record_edit_form
103<li>show_edit_table_form
104<li>get_default_line_edit_form_spec
105<li>show_edit_table_in_place_form
106<li>edit_link
107<li>show_query_form
108</ul>
109<p>
110<h2><a name="form_fields_generator_class">form_fields_generator_class</a>
111<span align=right class="section_edit_link">[<a href="/tbwiki/DocTablesInternals?action=edit&section=form_fields_generator_class">edit section</a>]</font></span>
112</h2>
113The form_fields_generator_class is used to create an instance of a
114form_fields_generator.  This is used with a form_spec to create
115an actual form.  It generates the correct HTML for each field, on
116the fly, by acting like a map where the string substitutions in
117the form get converted into appropriate HTML input elements.
118<p>
119<h2><a name="io_handle_*_classes">io_handle_* classes</a>
120<span align=right class="section_edit_link">[<a href="/tbwiki/DocTablesInternals?action=edit&section=io_handle_*_classes">edit section</a>]</font></span>
121</h2>
122These classes handle I/O operations for the different types of databases
123supported:
124<ul><li>test
125<li>moin_file
126<li>moin_in_page (inline in table block or named block)
127<li>attr_files
128<li>parsed_files
129</ul>
130<p>
131An io_handler instance has the following attributes:
132<ul><li>req - the request used to fetch the database
133<li>tb - the table instance
134<li>data_dir - the directory used to read the data from
135<li>source_spec
136</ul>
137<p>
138The io_handle_base class is a stub class, with methods for:
139<ul><li>read - read the whole database
140<li>get_record - (does not appear to be used)
141<li>add_record - (does not appear to be used)
142<li>update_record - (does not appear to be used)
143<li>remove_record - remove an individual record
144<li>write - write the whole database (not used?? see save_table_data)
145</ul>
146<p>
147Different classes implement these methods, according to the database type.
148<p>
149<h2><a name="class_capture_stderr">class capture_stderr</a>
150<span align=right class="section_edit_link">[<a href="/tbwiki/DocTablesInternals?action=edit&section=class_capture_stderr">edit section</a>]</font></span>
151</h2>
152In order to capture errors, a class is used to grab the errors and put
153them in a buffer.  This is to capture exceptions and put them in the
154message log, in case of unhandled error conditions.
155<p>
156<h1><a name="global_routines">global routines</a>
157<span align=right class="section_edit_link">[<a href="/tbwiki/DocTablesInternals?action=edit&section=global_routines">edit section</a>]</font></span>
158</h1>
159<ul><li>print_error
160<li>generate_field_input - used to generate an input field for a form element
161<li>value_trans
162<li>parse_attrs - given a block of data, create a map with key-value pairs
163<li>rec_sort - used to sort records (according to 'sortby' setting)
164<ul><li>cmp_rev(), cmp_int(), cmp_rev_int()
165</ul><li>set_sort_col_list
166<li>gen_row_output_list - generate a default row output list, based on the sortby spec.  The list is ordered and filtered.
167<li>setup_conf_and_db - set up configuration and source_spec, possibly reading from multiple blocks (table block, data block, conf block)
168<li>macro_get_table
169<li>get_table - an action?
170<li>add_record_form - an action in the table module
171<li>query_form - an action in the table module
172<li>edit_table - an action in the table module
173<li>edit_table_in_place
174<li>parse_moin_table
175<li>read_page_or_block
176<li>parse_attrdb_data
177<li>read_attrdb_file
178<li>get_filelist
179<li>db_from_attrdb_files
180<li>db_from_parsed_files
181<li>save_attrs_to_file
182<li>save_attrdb
183<li>remove_attrdb
184<li>convert_table_to_dict
185<li>render_moin_table
186<li>get_table_type - examines source_spec and conf, to determine the type of
187 database to handle
188<li>get_table_data
189<li>save_table_data - routine that implements save of data based on data type
190<ul><li>this appears to be a hold-over from before the implementation of the
191   io_handler_class
192<li>currently, the write() io_handlers call save_table_data
193</ul><li>action - multiplexor for table sub_actions, from the set:
194<ul><li>add_record
195<li>remove_record
196<li>edit_record_form
197<li>edit_record
198<li>save_all
199<li>add_column - not implemented
200<li>edit_column - not implemented
201<li>remove_column - not implemented
202<li>query
203</ul>
204</ul>
205<p>
206<h1><a name="Table_Processor">Table Processor</a>
207<span align=right class="section_edit_link">[<a href="/tbwiki/DocTablesInternals?action=edit&section=Table_Processor">edit section</a>]</font></span>
208</h1>
209The table processor has the following actions:
210<p>
211<ul><li>Table - main routine to return a table (from get_table() above)
212<li>add_record_form
213<li>query_form
214<li>edit_table -
215<li>edit_table_in_place -
216<li>action - process form actions (sub_actions)
217<ul><li>this performs some action, like processing a form or operation, then
218   sets a results message, and then shows the page (with results, hopefully).
219</ul>
220</ul>
221<p>
222<h1><a name="Notes">Notes</a>
223<span align=right class="section_edit_link">[<a href="/tbwiki/DocTablesInternals?action=edit&section=Notes">edit section</a>]</font></span>
224</h1>
225A table configuration can have the following attributes:
226<ul><li>conf=
227<li>query=
228<li>source_spec=
229<li>and all the fields shown in the table_conf_class list
230<ul><li>these are read like a map into the conf's attributes as strings directly from the configuration block
231</ul><li>a list of field attributes (in attrdb format, with 'field' as the record indicator)
232</ul>
233<p>
234The conf and query lines can "chain" to other blocks, so that a multiple
235"Views" can be constructed from the same data.
236<p>
237For example, a table could be defined like:
238<p>
239<pre>
240{{ {Data
241||foo||bar||baz||
242||1  ||yes ||5||
243||3  ||no  ||100||
244 
245}} }
246</pre>
247<p>
248<pre>
249{{ {#Conf1
250source_spec=#:Data
251sortby=bar,int
252field=bar
253possible_values="""yes
254no"""
255field=baz
256color_list="""(int(value))&lt;50:red
257(int(value)&lt;100:yellow"""
258}} }
259</pre>
260<p>
261<pre>
262{{ {#Query1
263col_list=foo,baz
264filter=foo=1
265}} }
266</pre>
267<p>
268<pre>
269{{ {!#Table
270conf=#:Conf1
271query=#:Query1
272}} }
273</pre>
274<p>
275source_specs indicate the source and type of data for the database:
276<ul><li>test_data = use the special built-in test data (read-only)
277<li>endswith '.*' = attr_files
278<li>startswith '#' = inline
279<li>startswith '_inline_' = inline
280<li>config has 'match_spec' = parsed
281<li>otherwise it's a moinmoin db in a file
282</ul>
283<p>
284sortby can have the following types:
285<ul><li>alpha
286<li>rev_alpha
287<li>int
288<li>rev_int
289</ul>
290<p>
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op

Differences for page "DocTablesInternals"


expected html
generated html
t No Differences Found t No Differences Found 
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op

Update saved output

Back to diff page

Return to Regression_Test page
TBWiki engine 1.9.3 by Tim Bird