try to avoid ValueError because of erroneous date

This commit is contained in:
Helmut Merz 2016-04-05 08:52:35 +02:00
parent 8190d56286
commit c7059e4f52

View file

@ -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):