From 41c810d9aedef63fd94810bb5514780f425725cf Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Mon, 19 Apr 2010 02:44:13 +0000 Subject: [PATCH] Don't crash on new-style newyear date tuple (newyear date is from trunk) svn: r15223 --- src/DateHandler/_DateDisplay.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/DateHandler/_DateDisplay.py b/src/DateHandler/_DateDisplay.py index 12de801fc..3aa5bad2b 100644 --- a/src/DateHandler/_DateDisplay.py +++ b/src/DateHandler/_DateDisplay.py @@ -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: