fix rss view: starttime may be None. Closes #2089063 stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 11 Nov 2011 14:32:12 +0100
branchstable
changeset 797 83056520c0a2
parent 796 6e49e3a7e6dd
child 798 b6a790bc5d43
fix rss view: starttime may be None. Closes #2089063
views/testexecution.py
--- a/views/testexecution.py	Mon Dec 05 13:19:39 2011 +0100
+++ b/views/testexecution.py	Fri Nov 11 14:32:12 2011 +0100
@@ -51,7 +51,10 @@
         if not changes_only:
             if exc.endtime is not None:
                 nb_checkers = len(exc.checkers)
-                duration = exc.endtime - exc.starttime
+                if exc.starttime:
+                    duration = exc.endtime - exc.starttime
+                else:
+                    duration = self._cw._('unknown duration')
                 if nb_checkers > 1:
                     w(u'<p>')
                     w(_(u'%(nb)s checkers run in %(dur)s')
@@ -64,8 +67,11 @@
                     w(u'</p>')
             else:
                 w(u'<p>')
-                w(_(u'running for %(dur)s')
-                       % {'dur': datetime.now() - exc.starttime})
+                if exc.starttime:
+                    duration = datetime.now() - exc.starttime
+                else:
+                    duration = self._cw._('unknown duration')
+                w(_(u'running for %(dur)s') % {'dur': duration})
                 w(u'</p>')
         changes = exc.status_changes()
         if changes_only: