Convieniences: get_year_calendar(int) or get_year_calendar(name); date.to_calendar(int) or to_calendar(name)
svn: r13764
This commit is contained in:
parent
b1e51013e6
commit
966ecbf20c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user