Make date.format_date render UNDEFINED_DATE as ''. This makes composite columns and templates behave in the same fashion as the GUI has for some time.

This commit is contained in:
Charles Haley 2011-01-16 11:26:34 +00:00
parent 4a9e8bcb2f
commit 5c4154bb0d

View File

@ -148,6 +148,9 @@ def format_date(dt, format, assume_utc=False, as_utc=False):
if len(mo.group(0)) == 2: return '%02d'%(dt.year % 100) if len(mo.group(0)) == 2: return '%02d'%(dt.year % 100)
return '%04d'%dt.year return '%04d'%dt.year
if dt == UNDEFINED_DATE:
return ''
format = re.sub('d{1,4}', format_day, format) format = re.sub('d{1,4}', format_day, format)
format = re.sub('M{1,4}', format_month, format) format = re.sub('M{1,4}', format_month, format)
return re.sub('yyyy|yy', format_year, format) return re.sub('yyyy|yy', format_year, format)