From 3c9319711a8b4cc91016043f80129362ab438dfc Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Thu, 13 Jun 2013 10:50:56 -0400 Subject: [PATCH] Don't use total_seconds for python < 2.7 The total_seconds function was added to datetime in python-2.7. For compatibility with previous versions of python, use its suggested equivalent (except drop microseconds, since we don't care about them in this context). Signed-off-by: Konstantin Ryabitsev Signed-off-by: Jeremy Kerr --- apps/patchwork/views/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/patchwork/views/__init__.py b/apps/patchwork/views/__init__.py index 681532a..a823388 100644 --- a/apps/patchwork/views/__init__.py +++ b/apps/patchwork/views/__init__.py @@ -190,8 +190,8 @@ def patch_to_mbox(patch): if patch.content: body += '\n' + patch.content - utc_timestamp = (patch.date - - datetime.datetime.utcfromtimestamp(0)).total_seconds() + delta = patch.date - datetime.datetime.utcfromtimestamp(0) + utc_timestamp = delta.seconds + delta.days*24*3600 mail = PatchMbox(body) mail['Subject'] = patch.name -- 2.39.2