Project

General

Profile

« Previous | Next » 

Revision 6357

xml_func.py: Simplifying functions: Added _nullIf(), to remove calls with no null value

View differences:

lib/xml_func.py
203 203
        xml_dom.replace(node, then)
204 204
simplifying_funcs['_if'] = _if
205 205

  
206
def _nullIf(node):
207
    '''
208
    *Must* be run to remove conditions that functions._nullIf() can't handle.
209
    '''
210
    params = dict(xml_dom.NodeEntryIter(node))
211
    null = params.get('null', None)
212
    value = params.get('value', None)
213
    
214
    if value == None: xml_dom.prune_parent(node) # empty
215
    elif null == None: xml_dom.replace(node, value) # nothing to null out
216
simplifying_funcs['_nullIf'] = _nullIf
217

  
206 218
#### Merging
207 219

  
208 220
simplifying_funcs['_alt'] = passthru

Also available in: Unified diff