summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2006-04-03 15:20:28 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2006-04-03 15:20:28 (GMT)
commitaba10cf153193032a494dbd0667a1b86a32d821b (patch)
tree71b8c7a5c93c15ca46511b3a97b9f068da1497de
parentebed3f629b9adedddca4f0d1d3e2408ea560a06f (diff)
downloadcpython-aba10cf153193032a494dbd0667a1b86a32d821b.zip
cpython-aba10cf153193032a494dbd0667a1b86a32d821b.tar.gz
cpython-aba10cf153193032a494dbd0667a1b86a32d821b.tar.bz2
Turn firstweekday into a property.
-rw-r--r--Lib/calendar.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py
index 1a4dbba..2b974bf 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -130,6 +130,15 @@ class Calendar(object):
def __init__(self, firstweekday=0):
self.firstweekday = firstweekday # 0 = Monday, 6 = Sunday
+ def getfirstweekday(self):
+ return self._firstweekday
+
+ def setfirstweekday(self, firstweekday):
+ if not MONDAY <= firstweekday <= SUNDAY:
+ raise IllegalWeekdayError(firstweekday)
+ self._firstweekday = firstweekday
+ firstweekday = property(getfirstweekday, setfirstweekday)
+
def iterweekdays(self):
"""
Return a iterator for one week of weekday numbers starting with the
@@ -559,14 +568,8 @@ class LocaleHTMLCalendar(HTMLCalendar):
# Support for old module level interface
c = TextCalendar()
-def firstweekday():
- return c.firstweekday
-
-def setfirstweekday(firstweekday):
- if not MONDAY <= firstweekday <= SUNDAY:
- raise IllegalWeekdayError(firstweekday)
- c.firstweekday = firstweekday
-
+firstweekday = c.getfirstweekday
+setfirstweekday = c.setfirstweekday
monthcalendar = c.monthdayscalendar
prweek = c.prweek
week = c.formatweek