Project

General

Profile

« Previous | Next » 

Revision 6753

xml_func.py: process(): row-based mode: preserving complex funcs: Fixed bug where functions with no params would crash reduce() because it requires at least one value when no initial value is specified

View differences:

lib/xml_func.py
149 149
        # pass-through optimization for aggregating functions with one arg
150 150
        value = items[0][1] # pass through first arg
151 151
    elif row_mode and (is_rel_func(name) or func == None): # row-based mode
152
        if reduce(operator.or_, (xml_dom.is_node(v) for n, v in items)):
153
            return # preserve complex funcs
152
        if items and reduce(operator.or_, (xml_dom.is_node(v)
153
            for n, v in items)): return # preserve complex funcs
154 154
        # Evaluate using DB
155 155
        try: value = sql_io.put(db, name, dict(items), on_error=on_error)
156 156
        except sql.DoesNotExistException: return # preserve unknown funcs

Also available in: Unified diff