From c7059e4f529db055a1a934b1840f5e71fe048c8a Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Tue, 5 Apr 2016 08:52:35 +0200 Subject: [PATCH] try to avoid ValueError because of erroneous date --- composer/schema/field.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/composer/schema/field.py b/composer/schema/field.py index 5bbc020..4619f95 100644 --- a/composer/schema/field.py +++ b/composer/schema/field.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Helmut Merz helmutm@cy55.de +# Copyright (c) 2016 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -315,7 +315,10 @@ class DateFieldInstance(NumberFieldInstance): if langInfo: locale = locales.getLocale(langInfo.language) fmt = locale.dates.getFormatter(*format) - return fmt.format(value) + try: + return fmt.format(value) + except ValueError: + return str(value) return str(value) def unmarshall(self, value):