From 966ecbf20c77fca099c8017d45b881bed1c1b734 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 11 Dec 2009 15:17:39 +0000 Subject: [PATCH] Convieniences: get_year_calendar(int) or get_year_calendar(name); date.to_calendar(int) or to_calendar(name) svn: r13764 --- src/gen/lib/date.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gen/lib/date.py b/src/gen/lib/date.py index 4bc0f765b..821136705 100644 --- a/src/gen/lib/date.py +++ b/src/gen/lib/date.py @@ -690,10 +690,7 @@ class Date(object): if isinstance(source, tuple): if calendar is None: self.calendar = Date.CAL_GREGORIAN - elif isinstance(calendar, int): - self.calendar = calendar - else: - self.calendar = lookup_calendar(calendar) + self.calendar = lookup_calendar(calendar) if modifier is None: self.modifier = Date.MOD_NONE else: @@ -1809,6 +1806,7 @@ def lookup_calendar(calendar): >>> lookup_calendar("hebrew") 2 """ + if isinstance(calendar, int): return calendar for pos, calendar_name in enumerate(Date.calendar_names): if calendar.lower() == calendar_name.lower(): return pos