template (filters): don't crash on invalid date in date_fmt
This commit is contained in:
parent
6020cae869
commit
5aec6ed680
1 changed files with 7 additions and 0 deletions
|
|
@ -353,6 +353,13 @@ class Renderer(object):
|
|||
return value if not current else u"{}_{}".format(value, current)
|
||||
|
||||
def _date_fmt(self, timestamp, fmt='short', date_only=False, auto_limit=None, auto_old_fmt=None):
|
||||
try:
|
||||
return self.date_fmt(timestamp, fmt, date_only, auto_limit, auto_old_fmt)
|
||||
except Exception as e:
|
||||
log.warning(_(u"Can't parse date: {msg}").format(msg=e))
|
||||
return timestamp
|
||||
|
||||
def date_fmt(self, timestamp, fmt='short', date_only=False, auto_limit=None, auto_old_fmt=None):
|
||||
"""format date according to locale
|
||||
|
||||
@param timestamp(basestring, int): unix time
|
||||
|
|
|
|||
Loading…
Reference in a new issue