From 9bd35a826b398bd3bdd98824f17a14538d14abb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Thu, 21 Mar 2013 13:40:37 -0300 Subject: Calculate mtime in a more multiplatform way --- src/leap/util/request_helpers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/leap/util') diff --git a/src/leap/util/request_helpers.py b/src/leap/util/request_helpers.py index c5d0f3f5..019ff353 100644 --- a/src/leap/util/request_helpers.py +++ b/src/leap/util/request_helpers.py @@ -19,6 +19,8 @@ Request helpers for backward compatible "parsing" of requests """ +import time + import json from dateutil import parser as dateparser @@ -50,6 +52,7 @@ def get_content(request): mtime = None last_modified = request.headers.get('last-modified', None) if last_modified: - mtime = int(dateparser.parse(last_modified).strftime("%s")) + dt = dateparser.parse(unicode(last_modified)) + mtime = int(time.mktime(dt.timetuple()) + dt.microsecond / 1000000.0) return contents, mtime -- cgit v1.2.3