Project

General

Profile

« Previous | Next » 

Revision 1309

xml_func.py: _date: Map date with only empty fields to NULL (occurs when all fields were e.g. 0 and were filtered to NULL by _nullIf)

View differences:

lib/xml_func.py
187 187
    except KeyError:
188 188
        items = dict(conv_items(int, items))
189 189
        try: items['year'] # year is required
190
        except KeyError, e: raise SyntaxException(e)
190
        except KeyError, e:
191
            if items == {}: return None # entire date is empty
192
            else: raise SyntaxException(e)
191 193
        items.setdefault('month', 1)
192 194
        items.setdefault('day', 1)
193 195
        try: date = datetime.date(**items)

Also available in: Unified diff