Project

General

Profile

« Previous | Next » 

Revision 6755

xml_func.py: Simplifying functions: Added _eq()

View differences:

lib/xml_func.py
222 222
    elif null == None: xml_dom.replace(node, value) # nothing to null out
223 223
simplifying_funcs['_nullIf'] = _nullIf
224 224

  
225
#### Comparison
226

  
227
def _eq(node):
228
    params = dict(xml_dom.NodeTextEntryIter(node))
229
    left = params.get('left', None)
230
    right = params.get('right', None)
231
    
232
    if is_scalar(left) and is_scalar(right): # constant
233
        xml_dom.replace_with_text(node, left == right)
234
    elif left == right: xml_dom.replace_with_text(node, True) # always True
235
simplifying_funcs['_eq'] = _eq
236

  
225 237
#### Merging
226 238

  
227 239
simplifying_funcs['_alt'] = passthru

Also available in: Unified diff