| t | | t | |
| <table align="right"><tr><td><div class="toc"> | | |
| Contents: | | |
| <ul> | | |
| <li><a href="#tbwiki_engine.py">tbwiki_engine.py</a></li> | | |
| <ul> | | |
| <li><a href="#Classes_overview">Classes overview</a></li> | | |
| <li><a href="#Functions">Functions</a></li> | | |
| <ul> | | |
| <li><a href="#main(req):_details">main(req): details</a></li> | | |
| </ul> | | |
| <li><a href="#Classes_details">Classes details</a></li> | | |
| </ul> | | |
| <li><a href="#table.py">table.py</a></li> | | |
| <ul> | | |
| <li><a href="#Classes_overview___2">Classes overview</a></li> | | |
| <li><a href="#Functions___2">Functions</a></li> | | |
| <li><a href="#Classes_details___2">Classes details</a></li> | | |
| </ul> | | |
| <li><a href="#data_scan.py">data_scan.py</a></li> | | |
| <li><a href="#vgchart.py">vgchart.py</a></li> | | |
| </ul> | | |
| </div></td></tr></table> | | |
| <p> | | |
| Here are some details about the operation of the code and the internal APIs | | |
| available: | | |
| <p> | | |
| <h1><a name="tbwiki_engine.py">tbwiki_engine.py</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocInternalAPI?action=edit§ion=tbwiki_engine.py">edit section</a>]</font></span> | | |
| </h1> | | |
| <p> | | |
| <h2><a name="Classes_overview">Classes overview</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocInternalAPI?action=edit§ion=Classes_overview">edit section</a>]</font></span> | | |
| </h2> | | |
| <ul><li><b>class stub_class</b> - formerly used as a flat-attribute class, like a struct, for the wiki config | | |
| <li><b>class config_class</b> - used for the wiki config | | |
| <li><b>class user_class</b> - used for user accounts | | |
| <li><b>class req_class</b> - used for the main request data | | |
| <li><b>class data_class</b> - used for data output into headers, footers, and pages | | |
| <li><b>class parse_state</b> - holds the context for the current parse | | |
| </ul> | | |
| <p> | | |
| <h2><a name="Functions">Functions</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocInternalAPI?action=edit§ion=Functions">edit section</a>]</font></span> | | |
| </h2> | | |
| <pre> | | |
| * def html_error(msg): | | |
| * def html_escape(str): | | |
| * def make_link(href, cover): | | |
| * def add_to_log(req, action, timestamp, message): | | |
| * def scan_log(req, page_name): | | |
| * def get_env(key): | | |
| * def show_env(env, full=0): | | |
| * def authenticate_user(req, name, password): | | |
| * def create_user(req, name, password): | | |
| * def html_bullet(state, indent, rest): | | |
| * def show_close(state): | | |
| * def html_close(state): | | |
| * def do_search(req, patc): | | |
| * def do_diff(req, page1, page2): | | |
| * def get_section(data, section): | | |
| * def get_named_block(lines, block_name): | | |
| * def put_named_block(lines, block_name, new_content): | | |
| * def set_section(data, section, section_text): | | |
| * def block_to_html(req, data): | | |
| * def line_to_html(state, line, continuation=0): | | |
| * def save_uploaded_file(req, form_field, upload_dir): | | |
| * def main(req) | | |
| </pre> | | |
| <h3><a name="main(req):_details">main(req): details</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocInternalAPI?action=edit§ion=main(req):_details">edit section</a>]</font></span> | | |
| </h3> | | |
| <p> | | |
| def main(req): | | |
| <p> | | |
| Main steps: | | |
| <ul><li>get the URL and POST query data | | |
| <li>determine what action should be performed. This defaults to "show" | | |
| and is specified in the URL with "action=<foo>" | | |
| <li>parse the page name out of the URL or query | | |
| <li>set the user | | |
| <li>load plugins (macros and processors) | | |
| <li>do main action loop, which is a "while not handled:" | | |
| <ul><li>check permissions (actions that need read and actions that need write) | | |
| <li>show | | |
| <ul><li>show header | | |
| <li>read page data | | |
| <li>convert to html | | |
| <li>print html | | |
| <li>set handled and break! | | |
| </ul><li>raw - show unconverted text (just html_escape it) | | |
| <li>split - print raw and formatted content side-by-side, for each paragraph | | |
| <li>edit - show an edit form | | |
| <li>save - save the data from an edit form | | |
| <li>links_here - show pages that link to this one (using do_search) | | |
| <li>search - show pages that match search term | | |
| <li>history - scan backups directory and show table of previous page versions | | |
| <li>info - show information about a page (last edit time, size, etc.) | | |
| <li>diff - show a diff of two revisions from the history page | | |
| <li>user.loginform - show a login form | | |
| <li>user.login - authenticate user, and set their cookie | | |
| <ul><li>after authentication, loop to a 'show' action | | |
| </ul><li>user.logout - clear the user account, and set the cookie | | |
| <ul><li>after logging out, loop to a 'show' action | | |
| </ul><li>user.createform - show a form for creating a user | | |
| <li>user.create - create a new user file based on the form | | |
| <li>user.editform - edit user data based on the form | | |
| <li>user.edit - save edited user data (NOT CURRENTLY IMPLEMENTED) | | |
| <li>upload - show form for uploading 3 files | | |
| <li>do_upload - process form for uploading files | | |
| <li>rename - show a rename form | | |
| <li>do_rename - process form for renaming a page | | |
| <li>delete - show a delete form | | |
| <li>really_delete - process form for deleting a page | | |
| <li>check for processor actions, of the form <processor_name>:<action> | | |
| <ul><li>if found a match, call it | | |
| <li>consider the request handled, on return | | |
| </ul><li>if no action matches, show an error | | |
| </ul><li>finally, show the footer | | |
| </ul> | | |
| <p> | | |
| <h2><a name="Classes_details">Classes details</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocInternalAPI?action=edit§ion=Classes_details">edit section</a>]</font></span> | | |
| </h2> | | |
| <pre> | | |
| class stub_class: | | |
| | | |
| class config_class: | | |
| def __init__(self): | | |
| | | |
| class user_class: | | |
| def __init__(self, name = "not-logged-in"): | | |
| | | |
| class req_class: | | |
| def __init__(self, config): | | |
| def set_page_name(self, page_name): | | |
| def page_filename(self): | | |
| def read_page(self, page_name=""): | | |
| def get_page_item(self, item_ref): | | |
| def put_page_item(self, item_ref, data): | | |
| def make_backup(self, content, page_name=""): | | |
| def make_backup_from_file(self, page_name=""): | | |
| def write_page(self, content, page_name=""): | | |
| def foo(self): | | |
| def make_url(self, page_name): | | |
| def html_escape(self, str): | | |
| def add_to_message(self, msg): | | |
| def add_msg_and_traceback(self, msg): | | |
| def show_header(self, title): | | |
| def show_footer(self): | | |
| def set_user(self): | | |
| def check_permission(self, wanted_access, page=None): | | |
| def parse_attrs(self, data): | | |
| | | |
| class data_class: | | |
| def __init__(self, req, init_data = {} ): | | |
| def __getitem__(self, key): | | |
| def page_url(self, req): | | |
| def asctime(self, req): | | |
| def login_form(self, req): | | |
| def login_form_nobr(self, req): | | |
| def nav_box_sidebar(self, req): | | |
| def nav_bar(self, req): | | |
| def nav_bar_bar(self, req): | | |
| def search_form(self, req): | | |
| def search_form_nobr(self, req): | | |
| def toolbox(self, req): | | |
| def action_bar(self, req): | | |
| def message(self, req): | | |
| | | |
| class parse_state: | | |
| def __init__(self, req): | | |
| </pre> | | |
| <p> | | |
| <h1><a name="table.py">table.py</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocInternalAPI?action=edit§ion=table.py">edit section</a>]</font></span> | | |
| </h1> | | |
| <p> | | |
| <h2><a name="Classes_overview___2">Classes overview</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocInternalAPI?action=edit§ion=Classes_overview___2">edit section</a>]</font></span> | | |
| </h2> | | |
| <ul><li>class form_fields_generator_class: | | |
| <li>class range_class: | | |
| <li>class io_handler_base: | | |
| <ul><li>class io_handler_test(io_handler_base): | | |
| <li>class io_handler_moin_file(io_handler_base): | | |
| <li>class io_handler_moin_in_page(io_handler_base): | | |
| <li>class io_handler_attr_files(io_handler_base): | | |
| <li>class io_handler_parsed_files(io_handler_base): | | |
| </ul><li>class table_conf_class: | | |
| <li>class table_class: | | |
| </ul> | | |
| <p> | | |
| <h2><a name="Functions___2">Functions</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocInternalAPI?action=edit§ion=Functions___2">edit section</a>]</font></span> | | |
| </h2> | | |
| <pre> | | |
| def print_error(msg): | | |
| def generate_field_input(tb, col_name, field_type, value, record_id): | | |
| def value_trans(tb, value): | | |
| def parse_range(tb, cell_row, cell_col, formula): | | |
| def do_sum(tb, range): | | |
| def parse_formula(tb, cell_row, cell_col, formula): | | |
| def value_eval(tb, cell_row, cell_col, value): | | |
| def rec_sort(id1, id2): | | |
| def cmp_rev(a,b): | | |
| def cmp_int(a,b): | | |
| def cmp_rev_int(a,b): | | |
| def set_sort_col_list(tb, sort_col_spec_str): | | |
| def gen_row_output_list(tb, sortby_spec): | | |
| def setup_conf_and_db(req, block=""): | | |
| def macro_get_table(req, args): | | |
| def get_table(req, content): | | |
| def add_record_form(req): | | |
| def query_form(req): | | |
| def edit_table(req): | | |
| def edit_table_in_place(req): | | |
| def parse_moin_table(tb, data, source_spec): | | |
| def read_page_or_block(req, spec, data_dir=""): | | |
| def write_block(req, spec, data_dir, data): | | |
| def parse_attrdb_data(data, record_id_name): | | |
| def read_attrdb_file(file_path, source_spec): | | |
| def get_filelist(data_dir, source_spec): | | |
| def db_from_attrdb_files(tb, data_dir, source_spec): | | |
| def db_from_parsed_files(tb, data_dir, source_spec): | | |
| def save_attrs_to_file(tb, record): | | |
| def remove_attrdb_file(tb, record_id): | | |
| def convert_table_to_dict(tb, convert_nums=0): | | |
| def render_moin_table(tb): | | |
| def get_table_type(conf, source_spec): | | |
| def get_table_data(req, data_dir, source_spec, page_name, conf): | | |
| def action(req): | | |
| def test(): | | |
| </pre> | | |
| <p> | | |
| <h2><a name="Classes_details___2">Classes details</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocInternalAPI?action=edit§ion=Classes_details___2">edit section</a>]</font></span> | | |
| </h2> | | |
| <pre> | | |
| class form_fields_generator_class: | | |
| def __init__(self, tb, record, col_map, field_type_hints=None): | | |
| def __getitem__(self, key): | | |
| | | |
| class range_class: | | |
| def __init__(self, start_row, start_col, end_row, end_col): | | |
| def get_direction(self): | | |
| def __repr__(self): | | |
| | | |
| class io_handler_base: | | |
| def __init__(self, req, tb, source_spec): | | |
| def read(self): | | |
| def get_record(self, record_id): | | |
| def add_record(self, record_id): | | |
| def update_record(self, record_id): | | |
| def remove_record(self, record_id): | | |
| def write(self): | | |
| | | |
| class table_conf_class: | | |
| def __init__(self): | | |
| def set_color_lists(self): | | |
| def get_conf(self, req, data=""): | | |
| | | |
| class table_class: | | |
| def __init__(self, req, conf, source_spec, page_name="(no page name)"): | | |
| def lookup(self, cell_row, cell_col, ref_addr): | | |
| def set_value(self, row, col, value): | | |
| def get_value(self, row, col): | | |
| def add_or_edit_numbered_record(self, record, record_id=""): | | |
| def remove_numbered_record(self, record_id): | | |
| def set_col_output_list(self, order=None): | | |
| def set_row_output_list(self, order=None): | | |
| def set_row_filter(self, filter): | | |
| def filter_match(self, record): | | |
| def show(self): | | |
| def add_to_message(self, message): | | |
| def html_string(self): | | |
| def get_default_edit_form_spec(self): | | |
| def show_record_edit_form(self, form_spec=None, record_id=None): | | |
| def show_edit_table_form(self, form_spec=None): | | |
| def get_default_line_edit_form_spec(self): | | |
| def show_edit_table_in_place_form(self, form_spec=None): | | |
| def edit_links(self): | | |
| def show_query_form(self): | | |
| </pre> | | |
| <h1><a name="data_scan.py">data_scan.py</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocInternalAPI?action=edit§ion=data_scan.py">edit section</a>]</font></span> | | |
| </h1> | | |
| <p> | | |
| <h1><a name="vgchart.py">vgchart.py</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocInternalAPI?action=edit§ion=vgchart.py">edit section</a>]</font></span> | | |
| </h1> | | |
| <p> | | |