Project

General

Profile

« Previous | Next » 

Revision 326

xml_func.py: Generate SyntaxExceptions on missing XML func args

View differences:

xml_func.py
23 23

  
24 24
def range_(items):
25 25
    items = dict(conv_items(float, items))
26
    return str(items['to'] - items['from'])
26
    try:
27
        to = items['to']
28
        from_ = items['from']
29
    except KeyError, e: raise SyntaxException(e)
30
    return str(to - from_)
27 31

  
28 32
def avg(items):
29 33
    count = 0
......
46 50
        else: date = (datetime.date(int(year), 1, 1) +
47 51
            datetime.timedelta(round((year % 1.)*365)))
48 52
    else:
49
        year = items['year']
53
        try: year = items['year']
54
        except KeyError, e: raise SyntaxException(e)
50 55
        month = items.get('month', '1')
51 56
        day = items.get('day', '1')
52 57
        try:

Also available in: Unified diff