Project

General

Profile

« Previous | Next » 

Revision 843

xml_func.py: Added FormatException for SyntaxExceptions generated by strftime() (which are often Python bugs)

View differences:

xml_func.py
12 12
        exc.ExceptionWithCause.__init__(self, 'Invalid XML function syntax',
13 13
            cause)
14 14

  
15
class FormatException(SyntaxException): pass
16

  
15 17
def map_items(func, items):
16 18
    return [(name, func(value)) for name, value in items]
17 19

  
......
62 64
        else: date = (datetime.date(int(year), 1, 1) +
63 65
            datetime.timedelta(round((year % 1.)*365)))
64 66
    try: return dates.strftime('%Y-%m-%d', date)
65
    except ValueError, e: raise SyntaxException(e)
67
    except ValueError, e: raise FormatException(e)
66 68

  
67 69
_name_parts_slices_items = [
68 70
    ('first', slice(None, 1)),

Also available in: Unified diff