Added month names for year/MON/day form
svn: r14162
This commit is contained in:
parent
4501b036df
commit
2e00aaa5cf
@ -297,6 +297,8 @@ class _Xml2Obj:
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class _Holidays:
|
class _Holidays:
|
||||||
""" Class used to read XML holidays to add to calendar. """
|
""" Class used to read XML holidays to add to calendar. """
|
||||||
|
MONTHS = ['jan', 'feb', 'mar', 'apr', 'may', 'jun',
|
||||||
|
'jul', 'aug', 'sep', 'oct', 'nov', 'dec']
|
||||||
def __init__(self, elements, country="US"):
|
def __init__(self, elements, country="US"):
|
||||||
self.debug = 0
|
self.debug = 0
|
||||||
self.elements = elements
|
self.elements = elements
|
||||||
@ -384,8 +386,7 @@ class _Holidays:
|
|||||||
elif mon == "*":
|
elif mon == "*":
|
||||||
m = date.month
|
m = date.month
|
||||||
else:
|
else:
|
||||||
m = ['jan', 'feb', 'mar', 'apr', 'may', 'jun',
|
m = self.MONTHS.index(mon) + 1
|
||||||
'jul', 'aug', 'sep', 'oct', 'nov', 'dec'].index(mon) + 1
|
|
||||||
dates_of_dayname = self.get_daynames(y, m, dayname)
|
dates_of_dayname = self.get_daynames(y, m, dayname)
|
||||||
|
|
||||||
if self.debug:
|
if self.debug:
|
||||||
@ -401,6 +402,8 @@ class _Holidays:
|
|||||||
y = int(y)
|
y = int(y)
|
||||||
if m == "*":
|
if m == "*":
|
||||||
m = date.month
|
m = date.month
|
||||||
|
elif m in self.MONTHS:
|
||||||
|
m = self.MONTHS.index(m) + 1
|
||||||
else:
|
else:
|
||||||
m = int(m)
|
m = int(m)
|
||||||
if d == "*":
|
if d == "*":
|
||||||
|
Loading…
Reference in New Issue
Block a user