Project

General

Profile

« Previous | Next » 

Revision 2434

db_xml.py: put_table(): Added basic special handling for structural XML functions, which for now just skips the function

View differences:

db_xml.py
154 154
            parent_ids_loc=parent_ids_loc)
155 155
    
156 156
    out_table = name_of(node)
157
    special_funcs = set(['_simplifyPath'])
158
    is_func = out_table in special_funcs
157 159
    
158 160
    # Divide children into fields and children with fkeys to parent
159 161
    row = {}
......
165 167
            row[child_name] = strings.to_unicode(xml_dom.value(child))
166 168
        else:
167 169
            child_value = xml_dom.value_node(child)
168
            if is_ptr(child_name) or xml_func.is_func(child_value):
170
            if is_func or is_ptr(child_name) or xml_func.is_func(child_value):
169 171
                row[child_name] = child_value
170 172
            else: children.append(child)
173
    
174
    # Special handling for structural XML functions
175
    if out_table == '_simplifyPath':
176
        try:
177
            next = row['next']
178
            require = row['require']
179
            path = row['path']
180
        except KeyError, e: raise xml_func.SyntaxError(e)
181
        
182
        # For now, just skip XML func
183
        return put_table_(path, parent_ids_loc)
184
    
185
    # Remove any explicit pkey
171 186
    try: del row[pkey(out_table)]
172 187
    except KeyError: pass
173 188
    

Also available in: Unified diff