From dfc00b26a76cd37f9219dac1ea860b0a8672c2c2 Mon Sep 17 00:00:00 2001 From: Unrud Date: Sat, 21 Apr 2018 11:18:43 +0200 Subject: [PATCH] Improve error message for unsupported timezones --- radicale/xmlutils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index c2e20fa..3873118 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -29,6 +29,7 @@ import copy import math import posixpath import re +import sys import xml.etree.ElementTree as ET from collections import OrderedDict from datetime import date, datetime, timedelta, timezone @@ -689,7 +690,13 @@ def find_tag_and_time_range(vobject_item): start = DATETIME_MIN if end is None: end = DATETIME_MAX - return tag, math.floor(start.timestamp()), math.ceil(end.timestamp()) + try: + return tag, math.floor(start.timestamp()), math.ceil(end.timestamp()) + except ValueError as e: + if str(e) == ("offset must be a timedelta representing a whole " + "number of minutes") and sys.version_info < (3, 6): + raise RuntimeError("Unsupported in Python < 3.6: %s" % e) from e + raise def name_from_path(path, collection):