[jToolkit-cvs] jToolkit/data dates.py,1.3,1.4
Brought to you by:
davidfraser,
friedelwolff
From: <dav...@us...> - 2003-10-14 09:31:02
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1:/tmp/cvs-serv29279 Modified Files: dates.py Log Message: changed errors to unique dates.ParseError so they can be easily detected Index: dates.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dates.py 25 Sep 2003 17:36:55 -0000 1.3 --- dates.py 14 Oct 2003 09:30:58 -0000 1.4 *************** *** 41,44 **** --- 41,47 ---- days = mxDateTime.DateTimeDeltaFromDays + class ParseError(ValueError): + pass + class dateparser: """a simulated type which can parse strings into dates given a format""" *************** *** 52,56 **** """simulates a constructor call for this dateparser""" if len(args) <> 1: ! raise TypeError("dateparser takes exactly 1 argument.") return self.parse(args[0]) --- 55,59 ---- """simulates a constructor call for this dateparser""" if len(args) <> 1: ! raise ParseError("dateparser takes exactly 1 argument.") return self.parse(args[0]) *************** *** 59,63 **** match = self.r.match(formatteddate) if match is None: ! raise TypeError("cannot parse formatted date: "+repr(formatteddate)+" with format string: "+repr(self.format)) g = match.groupdict() for key, value in g.items(): --- 62,66 ---- match = self.r.match(formatteddate) if match is None: ! raise ParseError("cannot parse formatted date: "+repr(formatteddate)+" with format string: "+repr(self.format)) g = match.groupdict() for key, value in g.items(): *************** *** 89,93 **** pass else: ! raise TypeError("invalid AM/PM value: "+repr(ampm)+" in date "+repr(formatteddate)+" with format string: "+repr(self.format)) return date(Y,M,D,h,m,s) --- 92,96 ---- pass else: ! raise ParseError("invalid AM/PM value: "+repr(ampm)+" in date "+repr(formatteddate)+" with format string: "+repr(self.format)) return date(Y,M,D,h,m,s) |