From 0621265c39e9ea626a442cd52c853187031a88f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 17 Apr 2012 11:42:09 +0200 Subject: [PATCH] guard against bad dates --- themis/importexport/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/themis/importexport/utils.py b/themis/importexport/utils.py index db9e7ba..6091b7d 100644 --- a/themis/importexport/utils.py +++ b/themis/importexport/utils.py @@ -113,7 +113,10 @@ class UtilityView(BrowserView): def convert(value, attr=None, context=None): if isinstance(value, datetime.date): - value = value.strftime('%Y-%m-%d') + try: + value = value.strftime('%Y-%m-%d') + except ValueError: + value = None elif isinstance(value, datetime.datetime): value = value.strftime('%Y-%m-%d %H:%M:%S') elif isinstance(value, plone.namedfile.file.NamedBlobFile) or \