fix a bug deltatime hasn't a hours or minutes attributes tls-sprint
authorGraziella Toutoungis <graziella.toutoungis@logilab.fr>
Thu, 07 May 2009 12:46:35 +0200
branchtls-sprint
changeset 1712 32ab85031814
parent 1711 182536159750
child 1713 d817f23439ba
fix a bug deltatime hasn't a hours or minutes attributes
web/views/baseviews.py
--- a/web/views/baseviews.py	Thu May 07 02:47:06 2009 -0700
+++ b/web/views/baseviews.py	Thu May 07 12:46:35 2009 +0200
@@ -68,6 +68,7 @@
     def cell_call(self, row, col, props=None, displaytime=False, format='text/html'):
         etype = self.rset.description[row][col]
         value = self.rset.rows[row][col]
+       
         if etype == 'String':
             entity, rtype = self.rset.related_entity(row, col)
             if entity is not None:
@@ -89,10 +90,10 @@
                 self.w(self.req.__('%%d%sweeks' % space) % (value.days // 7))
             elif value.days > 2:
                 self.w(self.req.__('%%d%sdays' % space) % int(value.days))
-            elif value.hours > 2:
-                self.w(self.req.__('%%d%shours' % space) % int(value.hours))
-            elif value.minutes >= 2:
-                self.w(self.req.__('%%d%sminutes' % space) % int(value.minutes))
+            elif value.seconds > 3600:
+                self.w(self.req.__('%%d%shours' % space) % int(value.seconds // 3600))
+            elif value.seconds >= 120:
+                self.w(self.req.__('%%d%sminutes' % space) % int(value.seconds // 60))
             else:
                 self.w(self.req.__('%%d%sseconds' % space) % int(value.seconds))
             return