From af251f267b230d3bcf524bc8ef74a19263b1c70d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= Date: Sat, 26 Sep 2015 21:21:56 +0200 Subject: [PATCH] La date peut valoir None dans localized_datetime --- crans_utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crans_utils.py b/crans_utils.py index 0e5357d..3b358bc 100644 --- a/crans_utils.py +++ b/crans_utils.py @@ -350,10 +350,11 @@ def localized_datetime(date=None, tz=None): %Y%m%d%H%M%S, and a tz timezone looking like +0200""" if tz is None: - if "+" in date or '-' in date or 'Z' in date: - if date.endswith("Z"): - date = date[:-1] + "+0000" - date, tz = date[:-5], date[-5:] + if date is not None: + if "+" in date or '-' in date or 'Z' in date: + if date.endswith("Z"): + date = date[:-1] + "+0000" + date, tz = date[:-5], date[-5:] _notz = (tz is None)