Daniel Shahaf wrote:
You don't do any input validation on the date in argv anywhere, so

Right. I'm not wanting to spend much time on niceties as I want to change a lot of this to read data from somewhere else, but then it still might want validating at this level.

[...]
release_date = time.strptime(args.news_release_date, "YYYY-mm-dd") if 
args.news_release_date else datetime.date.today()
… { 'date': release_date.strftime("YYYYmmdd"),
     'date_pres': release_date.strftime(…) }

Sounds good.  Format strings would be %Y-%m-%d etc.

At a quick try I couldn't get either "time.strptime" nor "datetime.strptime" to work. The latter says "AttributeError: 'module' object has no attribute 'strptime'"... which puzzles me as the docs say it's been available since Python 2.5. I didn't bother to pursue doing it using the "time" module though there was nothing stopping me.

Please just do whatever fixes it if you like, else maybe I'll have another go later but not urgently.

- Julian

Reply via email to