Don't crash on new-style newyear date tuple (newyear date is from trunk)

svn: r15223
This commit is contained in:
Doug Blank 2010-04-19 02:44:13 +00:00
parent cf6a378e0a
commit 41c810d9ae

View File

@ -139,7 +139,12 @@ class DateDisplay(object):
Formats the extra items (calendar, newyear) for a date.
"""
scal = self.calendar[cal]
snewyear = self.newyear[newyear]
if isinstance(newyear, int) and newyear <= len(self.newyear):
snewyear = self.newyear[newyear]
elif isinstance(newyear, (list, tuple)):
snewyear = "%s-%s" % (newyear[0], newyear[1])
else:
snewyear = "Err"
retval = ""
for item in [scal, snewyear]:
if item: