Project

General

Profile

« Previous | Next » 

Revision 2602

xml_func.py: process(): Refactored to emphasize special handling for row-based and column-based modes. In row-based mode, always use a DB relational function over a local XML function when possible, to faciliate testing of DB relational functions in row-based mode. (The shadowed local XML version will still be tested in non-DB modes, such as outputting to intermediate XML files.)

View differences:

map
163 163
    
164 164
    if out_is_db:
165 165
        out_db = connect_db(out_db_config)
166
        relational_funcs = set(sql.tables(out_db, schema_like='%',
166
        rel_funcs = set(sql.tables(out_db, schema_like='%',
167 167
            table_like=r'\__%'))
168 168
    
169 169
    def process_input(root, row_ready, map_path):
......
323 323
                map_table(col_names, []) # just create the template
324 324
                
325 325
                # Strip XML functions not in the DB
326
                preserve = db_xml.put_table_special_funcs | relational_funcs
327
                xml_func.process(root, preserve=preserve, strip=True)
326
                special_funcs = db_xml.put_table_special_funcs | rel_funcs
327
                xml_func.process(root, rel_funcs=special_funcs)
328 328
                if debug: log_debug('Putting stripped:\n'+str(root))
329 329
                    # only calc if debug
330 330
                
......
405 405
                pool.share_vars(locals())
406 406
                
407 407
                row_root = root.cloneNode(True) # deep copy so don't modify root
408
                xml_func.process(row_root, on_error)
408
                xml_func.process(row_root, on_error, rel_funcs, out_db)
409 409
                if not xml_dom.is_empty(row_root):
410 410
                    assert xml_dom.has_one_child(row_root)
411 411
                    try:

Also available in: Unified diff