can't compare date and datetime tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 15 Apr 2009 17:23:26 +0200
branchtls-sprint
changeset 1364 3acc823121b6
parent 1363 d8f2c3953eb5
child 1365 39a3bc7899d5
can't compare date and datetime
web/views/wdoc.py
--- a/web/views/wdoc.py	Wed Apr 15 17:22:57 2009 +0200
+++ b/web/views/wdoc.py	Wed Apr 15 17:23:26 2009 +0200
@@ -16,7 +16,7 @@
 
 from cubicweb.selectors import match_form_params
 from cubicweb.view import StartupView
-from cubicweb.utils import strptime
+from cubicweb.utils import strptime, todate
 from cubicweb.common.uilib import rest_publish
 from cubicweb.web import NotFound
 
@@ -192,6 +192,7 @@
         title = self.req._(self.title)
         restdata = ['.. -*- coding: utf-8 -*-', '', title, '='*len(title), '']
         w = restdata.append
+        today = date.today()
         for fpath in self.config.locate_all_files(rid):
             cl = ChangeLog(fpath)
             encoding = 'utf-8'
@@ -205,9 +206,9 @@
                     w(unicode(line, encoding))
             for entry in cl.entries:
                 if entry.date:
-                    edate = strptime(entry.date, '%Y-%m-%d')
+                    edate = todate(strptime(entry.date, '%Y-%m-%d'))
                 else:
-                    edate = date.today()
+                    edate = today
                 messages = []
                 for msglines, submsgs in entry.messages:
                     msgstr = unicode(' '.join(l.strip() for l in msglines), encoding)
@@ -225,7 +226,7 @@
                 fdate = self.format_date(edate)
                 w(u'\n%s' % fdate)
                 w('~' * len(fdate))
-                latestdate = date
+                latestdate = edate
             for msg in messages:
                 w(u'* %s' % msg)
                 i += 1