2 date_regexp = re.compile('(?P<number>\d{1,2})(\D.*)?\Z',re.U)
5 def __init__(self,path):
11 # This directory is not a month-day directory
13 obsolete = date <= datetime.datetime.now()
17 spp = self.path.split(u'/')
18 year = datetime.datetime.now().year
20 if len(spp) < 2 or len(spp[0]) == 0:
21 month_match = date_regexp.match(spp[-1])
22 if month_match == None:
24 month = int(month_match.group('number').rstrip(u' \r\n'))
27 month_match = date_regexp.match(spp[-2])
28 day_match = date_regexp.match(spp[-1])
29 if month_match == None or day_match == None:
31 month = int(month_match.group('number').rstrip(u' \r\n'))
32 day = int(day_match.group('number').rstrip(u' \r\n'))
36 year = int(spp[-3].rstrip(u' \r\n'))
43 return datetime.datetime(year,month,day)