dewflex:/usr/lib/python2.1/site-packages/roundup# diff date_orig.py date.py 81a82,85 > > @@ Modified Luke Opperman luke@amoebagod.com 2003-01-29 > @@ spec re now accepts "/" alternative to "-", so "2003/1/23" is valid, > @@ and more importantly, "1/23" is valid. 223c227 < (((?P\d\d\d\d)-)?((?P\d\d?)-(?P\d\d?))?)? # yyyy-mm-dd --- > (((?P\d\d\d\d)[-/])?((?P\d\d?)[-/](?P\d\d?))?)? # yyyy- mm-dd 272c276,278 < self.applyInterval(Interval(info['o'])) --- > # call Interval with allowdate=0 to avoid > # infinite loop of evaluating trailing invalid formats. > self.applyInterval(Interval(info['o'],allowdate=0)) 323a330,336 > > @@ Modified Luke Opperman luke@amoebagod.com 2003-01-29 > @@ Now accepts trailing Date-spec in spec, which is assumed to be > @@ an offset. Motivation: Interval("... 2003-01-23") creates an Interval > @@ of the difference between the regular interval generated and > @@ the date 01-23. Moreso, Interval("2003-01-23") creates an Interval > @@ from now to that date. 325,326c338,343 < def __init__(self, spec, sign=1): < """Construct an interval given a specification.""" --- > def __init__(self, spec, sign=1, allowdate=1): > """ > Construct an interval given a specification. > allowdate sets whether to interpret trailing > spec chars as a possible date. > """ 328c345 < self.set(spec) --- > self.set(spec, allowdate=allowdate) 379c396 < def set(self, spec, interval_re=re.compile(''' --- > def set(self, spec, allowdate=1, interval_re=re.compile(''' 386c403,404 < \s*''', re.VERBOSE), serialised_re=re.compile(''' --- > \s*(?P.+)? # date > ''', re.VERBOSE), serialised_re=re.compile(''' 411a430,434 > if allowdate and info['D'] is not None: > dat = Date(info['D']) > if dat != Date(): > y = Date(".") - (self + dat) > self.__init__(y.get_tuple())