From 75313bba031a38864032f56326a5f36025672f48 Mon Sep 17 00:00:00 2001 From: Justin Fay Date: Wed, 15 Apr 2015 11:08:14 +0100 Subject: [PATCH 1/2] Python 2.6 fix for `timedelta.total_seconds` --- flask_kvsession/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flask_kvsession/__init__.py b/flask_kvsession/__init__.py index cd2ab38..46ebdcc 100644 --- a/flask_kvsession/__init__.py +++ b/flask_kvsession/__init__.py @@ -189,7 +189,12 @@ def save_session(self, app, session, response): if getattr(store, 'ttl_support', False): # TTL is supported - ttl = current_app.permanent_session_lifetime.total_seconds() + try: + ttl = current_app.permanent_session_lifetime.total_seconds() + except AttributeError: + # Python 2.6 support + delta = current_app.permanent_session_lifetime + ttl = delta.seconds + delta.days * 24 * 3600 store.put(session.sid_s, data, ttl) else: store.put(session.sid_s, data) From 6aaf169564cb575c49e227418ce6e236a1f657e3 Mon Sep 17 00:00:00 2001 From: Justin Fay Date: Wed, 15 Apr 2015 11:23:59 +0100 Subject: [PATCH 2/2] Add Python2.6 to tox and travis --- .travis.yml | 1 + tox.ini | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e27ffd5..1341425 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: python env: +- TOXENV=py26 - TOXENV=py27 - TOXENV=py33 install: pip install tox diff --git a/tox.ini b/tox.ini index a2fd8d0..48d36e7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py33 +envlist = py26,py27,py33 [testenv] deps=