Mercurial > p > roundup > code
changeset 1184:945369929bf8
oops
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 23 Sep 2002 07:09:15 +0000 |
| parents | 08a13a84ed43 |
| children | 3b0735ef8207 |
| files | roundup/date.py |
| diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/roundup/date.py Mon Sep 23 06:48:35 2002 +0000 +++ b/roundup/date.py Mon Sep 23 07:09:15 2002 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: date.py,v 1.29 2002-09-23 06:48:34 richard Exp $ +# $Id: date.py,v 1.30 2002-09-23 07:09:15 richard Exp $ __doc__ = """ Date, time and time interval handling. @@ -215,25 +215,25 @@ return str def set(self, spec, offset=0, date_re=re.compile(r''' - (((?P<y>\d\d\d\d)-)?((?P<m>\d\d?)-(?P<d>\d\d?))?)? # yyyy-mm-dd - (?P<n>\.)? # . - (((?P<H>\d?\d):(?P<M>\d\d))?(:(?P<S>\d\d))?)? # hh:mm:ss - (?P<o>.+)? # offset + (((?P<y>\d{4}-)?((?P<m>\d\d?)-(?P<d>\d\d?))?)? # yyyy-mm-dd + (?P<n>\.)? # . + (((?P<H>\d?\d):(?P<M>\d\d))?(:(?P<S>\d\d))?)? # hh:mm:ss + (?P<o>.+)? # offset ''', re.VERBOSE), serialised_re=re.compile(''' - (\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2}) - ''')): + (\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d) + ''', re.VERBOSE)): ''' set the date to the value in spec ''' m = serialised_re.match(spec) - if m: + if m is not None: # we're serialised - easy! self.year, self.month, self.day, self.hour, self.minute, \ - self.second = map(int, m.groups()[1:7]) + self.second = map(int, m.groups()[:6]) return # not serialised data, try usual format m = date_re.match(spec) - if not m: + if m is None: raise ValueError, _('Not a date spec: [[yyyy-]mm-dd].' '[[h]h:mm[:ss]][offset]')
