--- a/web/views/baseviews.py Wed Sep 16 17:27:04 2009 +0200
+++ b/web/views/baseviews.py Wed Sep 16 17:29:45 2009 +0200
@@ -15,6 +15,8 @@
__docformat__ = "restructuredtext en"
_ = unicode
+from datetime import timedelta
+
from rql import nodes
from logilab.mtconverter import TransformError, xml_escape, xml_escape
@@ -77,6 +79,13 @@
self.w(entity.printable_value(rtype, value, format=format))
return
if etype in ('Time', 'Interval'):
+ if etype == 'Interval' and isinstance(value, (int, long)):
+ # `date - date`, unlike `datetime - datetime` gives an int
+ # (number of days), not a timedelta
+ # XXX should rql be fixed to return Int instead of Interval in
+ # that case? that would be probably the proper fix but we
+ # loose information on the way...
+ value = timedelta(days=value)
# value is DateTimeDelta but we have no idea about what is the
# reference date here, so we can only approximate years and months
if format == 'text/html':