diff --git a/VERSION b/VERSION index f669d738..d733dfd4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.5.1-stable+timestamp.2013.06.23.08.49.34 +Version 2.5.1-stable+timestamp.2013.06.23.08.50.58 diff --git a/gluon/dal.py b/gluon/dal.py index aeb7708d..b67fc3d2 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -6045,25 +6045,25 @@ class IMAPAdapter(NoSQLAdapter): add adds to the date object """ - months = [None, "Jan","Feb","Mar","Apr","May","Jun", - "Jul", "Aug","Sep","Oct","Nov","Dec"] + months = [None, "JAN","FEB","MAR","APR","MAY","JUN", + "JUL", "AUG","SEP","OCT","NOV","DEC"] if isinstance(date, basestring): # Prevent unexpected date response format try: dayname, datestring = date.split(",") - except (ValueError): - LOGGER.debug("Could not parse date text: %s" % date) + date_list = datestring.strip().split() + year = int(date_list[2]) + month = months.index(date_list[1].upper()) + day = int(date_list[0]) + hms = map(int, date_list[3].split(":")) + return datetime.datetime(year, month, day, + hms[0], hms[1], hms[2]) + add + except (ValueError, AttributeError, IndexError), e: + LOGGER.error("Could not parse date text: %s. %s" % + (date, e)) return None - date_list = datestring.strip().split() - year = int(date_list[2]) - month = months.index(date_list[1]) - day = int(date_list[0]) - hms = map(int, date_list[3].split(":")) - return datetime.datetime(year, month, day, - hms[0], hms[1], hms[2]) + add elif isinstance(date, (datetime.datetime, datetime.date)): return (date + add).strftime("%d-%b-%Y") - else: return None