From f79b04884cd7b4ec8b826cbf1d8f9e4d67d4bd7a Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sat, 2 Mar 2013 12:56:12 -0600 Subject: [PATCH] dal parse_date should always return date, issue 1344, thanks Niphlod --- VERSION | 2 +- gluon/dal.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ab57e398..14573756 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.4.1-alpha.2+timestamp.2013.03.02.12.54.01 +Version 2.4.1-alpha.2+timestamp.2013.03.02.12.55.37 diff --git a/gluon/dal.py b/gluon/dal.py index 231d54a9..7de57480 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -1890,6 +1890,8 @@ class BaseAdapter(ConnectionPool): return value == True or str(value)[:1].lower() == 't' def parse_date(self, value, field_type): + if isinstance(value, datetime.datetime): + return value.date() if not isinstance(value, (datetime.date,datetime.datetime)): (y, m, d) = map(int, str(value)[:10].strip().split('-')) value = datetime.date(y, m, d)