Roundup Tracker - Issues

Message615

Author anonymous
Recipients
Date 2003-01-30.21:19:20
Message-id
In-reply-to
I've made a few changes for our needs to the date.py 
Date() and Interval() 
classes, and thought I'd pass them along. 

Motivations: 

The ISO yyyy-mm-dd format was causing slight trouble, 
and most of the users who 
had trouble with it would enter dates like "1/23" 
or "1/23/2003". 

Also, I wanted to use Intervals for duedates on a tracker 
instance I'm 
creating, but users still wanted to be able to enter dates, 
and have them 
converted to Intervals automatically. 

Changes: 

I decided a compromise on the date formatting issue 
was best, not to try to 
fully change roundup's date format (as we all know the 
ambiguities with the 
m/d/year format). Instead, I simply made "/" an 
alternative separator to "-", 
so that "1/23" is properly converted. This handles most 
of our needs, the rest 
is met through education ("2003/1/23" for instance, or 
the real ISO). 

On the Interval side, I also went for a minimal change. 
An additional term in 
the spec regex is a trailing date spec. If it exists, it tries 
to create a 
date, adds that date to itself (an Interval), and subtracts 
the result from now. 
This allows Interval("+2d 1/23") (result: <Interval -4d> as 
of 1/29), or most 
important in our case, Interval("2/28") (result: <Interval 
+29d> as of 1/29). 

(A side note: an infinite loop is possible if there are 
trailing bad chars, as 
both classes now assume that trailing spec chars are a 
possible spec for the 
other class. Interval now has a default 
argument "allowdate" to control this 
behavior.) 

Diff is below. Use it if you want.

- Luke Opperman 
History
Date User Action Args
2009-02-03 14:20:13adminlinkissue677764 messages
2009-02-03 14:20:13admincreate