Skip to content

Commit bc86bb1

Browse files
author
Richard Jones
committed
oops
1 parent d485b59 commit bc86bb1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

roundup/date.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: date.py,v 1.29 2002-09-23 06:48:34 richard Exp $
18+
# $Id: date.py,v 1.30 2002-09-23 07:09:15 richard Exp $
1919

2020
__doc__ = """
2121
Date, time and time interval handling.
@@ -215,25 +215,25 @@ def pretty(self):
215215
return str
216216

217217
def set(self, spec, offset=0, date_re=re.compile(r'''
218-
(((?P<y>\d\d\d\d)-)?((?P<m>\d\d?)-(?P<d>\d\d?))?)? # yyyy-mm-dd
219-
(?P<n>\.)? # .
220-
(((?P<H>\d?\d):(?P<M>\d\d))?(:(?P<S>\d\d))?)? # hh:mm:ss
221-
(?P<o>.+)? # offset
218+
(((?P<y>\d{4}-)?((?P<m>\d\d?)-(?P<d>\d\d?))?)? # yyyy-mm-dd
219+
(?P<n>\.)? # .
220+
(((?P<H>\d?\d):(?P<M>\d\d))?(:(?P<S>\d\d))?)? # hh:mm:ss
221+
(?P<o>.+)? # offset
222222
''', re.VERBOSE), serialised_re=re.compile('''
223-
(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})
224-
''')):
223+
(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)
224+
''', re.VERBOSE)):
225225
''' set the date to the value in spec
226226
'''
227227
m = serialised_re.match(spec)
228-
if m:
228+
if m is not None:
229229
# we're serialised - easy!
230230
self.year, self.month, self.day, self.hour, self.minute, \
231-
self.second = map(int, m.groups()[1:7])
231+
self.second = map(int, m.groups()[:6])
232232
return
233233

234234
# not serialised data, try usual format
235235
m = date_re.match(spec)
236-
if not m:
236+
if m is None:
237237
raise ValueError, _('Not a date spec: [[yyyy-]mm-dd].'
238238
'[[h]h:mm[:ss]][offset]')
239239

0 commit comments

Comments
 (0)