sobjects/cwxmlparser.py
changeset 11034 75d752e6daf7
parent 10758 a34edc1057c0
--- a/sobjects/cwxmlparser.py	Fri Dec 18 09:23:23 2015 +0100
+++ b/sobjects/cwxmlparser.py	Tue Dec 22 15:35:10 2015 +0100
@@ -37,6 +37,7 @@
 from six import text_type
 from six.moves.urllib.parse import urlparse, urlunparse, parse_qs, urlencode
 
+import pytz
 from logilab.common.date import todate, totime
 from logilab.common.textutils import splitstrip, text_to_dict
 from logilab.common.decorators import classproperty
@@ -65,7 +66,11 @@
 # XXX handle timezone, though this will be enough as TZDatetime are
 # serialized without time zone by default (UTC time). See
 # cw.web.views.xmlrss.SERIALIZERS.
-DEFAULT_CONVERTERS['TZDatetime'] = convert_datetime
+def convert_tzdatetime(ustr):
+    date = convert_datetime(ustr)
+    date = date.replace(tzinfo=pytz.utc)
+    return date
+DEFAULT_CONVERTERS['TZDatetime'] = convert_tzdatetime
 def convert_time(ustr):
     return totime(datetime.strptime(ustr, '%H:%M:%S'))
 DEFAULT_CONVERTERS['Time'] = convert_time