From 7f411e0b6a78ca00d78f722b4ba6334972578aad Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 4 Oct 2008 17:17:13 +0200 Subject: [PATCH] fix parse date --- oxweb/imdb.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oxweb/imdb.py b/oxweb/imdb.py index 9591d05..cde4335 100644 --- a/oxweb/imdb.py +++ b/oxweb/imdb.py @@ -372,12 +372,17 @@ def getMovieReleaseDate(imdbId): return first_release def _parseDate(d): + ''' + >>>_parseDate('3 March 1972') + '1972-03-03' + ''' try: parsed_date = time.strptime(d, "%d %B %Y") parsed_date = '%s-%02d-%02d' % (parsed_date.tm_year, parsed_date.tm_mon, parsed_date.tm_mday) - parsed_date = time.strftime('%Y-%m-%d', parsed_date) return parsed_date except: + import traceback + traceback.print_exc() try: parsed_date = time.strptime(d, "%B %Y") parsed_date = '%s-%02d-01' % (parsed_date.tm_year, parsed_date.tm_mon)