[perf-web] Fix error with Python 2.7+ code path



commit a4ff665123b3bd2cc60099e45c763be90799034e
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Wed Jul 23 18:17:56 2014 -0400

    Fix error with Python 2.7+ code path
    
    When adding support for lack of timedelta.total_seconds() in Pyhton 2,6,
    the 2.7 alternative wasn't finished.

 metrics/views.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/metrics/views.py b/metrics/views.py
index c308667..dbcc856 100644
--- a/metrics/views.py
+++ b/metrics/views.py
@@ -20,7 +20,7 @@ _EPOCH = datetime(1970, 1, 1)
 # timedelta.total_seconds added in 2.7
 if hasattr(timedelta, 'total_seconds'):
     def unix_time(dt):
-        total_seconds(dt - _EPOCH)
+        return (dt - _EPOCH).total_seconds()
 else:
     def unix_time(dt):
         td = dt - _EPOCH


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]