Kaydet (Commit) 2a1b4a69 authored tarafından Walter Dörwald's avatar Walter Dörwald

For backwards compatibility reasons the global function

setfirstweekday() still needs to do a range check.
üst 72d84af4
......@@ -135,6 +135,7 @@ class Calendar(object):
def setfirstweekday(self, firstweekday):
self._firstweekday = firstweekday
firstweekday = property(getfirstweekday, setfirstweekday)
def iterweekdays(self):
......@@ -159,7 +160,7 @@ class Calendar(object):
while True:
yield date
date += oneday
if date.month != month and date.weekday() == self.firstweekday%7:
if date.month != month and date.weekday() == self.firstweekday:
break
def itermonthdays2(self, year, month):
......@@ -567,7 +568,12 @@ class LocaleHTMLCalendar(HTMLCalendar):
c = TextCalendar()
firstweekday = c.getfirstweekday
setfirstweekday = c.setfirstweekday
def setfirstweekday(firstweekday):
if not MONDAY <= firstweekday <= SUNDAY:
raise IllegalWeekdayError(firstweekday)
c.firstweekday = firstweekday
monthcalendar = c.monthdayscalendar
prweek = c.prweek
week = c.formatweek
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment