summaryrefslogtreecommitdiffstats
path: root/Lib/calendar.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-11-12 01:32:03 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-11-12 01:32:03 (GMT)
commit96f31636f4af949dd0975c9381d284915c9d76f6 (patch)
tree61de113ffa9a0011ca4280a208f825dc726b4438 /Lib/calendar.py
parent29fd7120e420014d5c32f5864a1d3c19ffa73c7f (diff)
downloadcpython-96f31636f4af949dd0975c9381d284915c9d76f6.zip
cpython-96f31636f4af949dd0975c9381d284915c9d76f6.tar.gz
cpython-96f31636f4af949dd0975c9381d284915c9d76f6.tar.bz2
Merged revisions 58930-58938 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r58931 | vinay.sajip | 2007-11-11 15:27:30 +0100 (Sun, 11 Nov 2007) | 1 line Fixed a bug reported (in private email, by Robert Crida) in logging configuration whereby child loggers of a logger named in a configuration file, which are not themselves named in the configuration, are disabled when the configuration is applied. ........ r58932 | georg.brandl | 2007-11-11 16:16:16 +0100 (Sun, 11 Nov 2007) | 2 lines Remove duplication of "this". ........ r58935 | christian.heimes | 2007-11-12 02:15:40 +0100 (Mon, 12 Nov 2007) | 2 lines Added new decorator syntax to property.__doc__ Guido prefers _x over __x. ........ r58936 | christian.heimes | 2007-11-12 02:20:56 +0100 (Mon, 12 Nov 2007) | 2 lines Fix for #1427: Error in standard module calendar the prweek() method is still broken and I can't figure out how it suppose to work. ........ r58938 | andrew.kuchling | 2007-11-12 02:25:21 +0100 (Mon, 12 Nov 2007) | 1 line Re-word sentence ........
Diffstat (limited to 'Lib/calendar.py')
-rw-r--r--Lib/calendar.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py
index 5487095..e811518 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -6,7 +6,9 @@ Sunday as the last (the European convention). Use setfirstweekday() to
set the first day of the week (0=Monday, 6=Sunday)."""
from __future__ import with_statement
-import sys, datetime, locale
+import sys
+import datetime
+import locale as _locale
__all__ = ["IllegalMonthError", "IllegalWeekdayError", "setfirstweekday",
"firstweekday", "isleap", "leapdays", "weekday", "monthrange",
@@ -485,11 +487,11 @@ class TimeEncoding:
self.locale = locale
def __enter__(self):
- self.oldlocale = locale.setlocale(locale.LC_TIME, self.locale)
- return locale.getlocale(locale.LC_TIME)[1]
+ self.oldlocale = _locale.setlocale(_locale.LC_TIME, self.locale)
+ return _locale.getlocale(_locale.LC_TIME)[1]
def __exit__(self, *args):
- locale.setlocale(locale.LC_TIME, self.oldlocale)
+ _locale.setlocale(_locale.LC_TIME, self.oldlocale)
class LocaleTextCalendar(TextCalendar):
@@ -503,7 +505,7 @@ class LocaleTextCalendar(TextCalendar):
def __init__(self, firstweekday=0, locale=None):
TextCalendar.__init__(self, firstweekday)
if locale is None:
- locale = locale.getdefaultlocale()
+ locale = _locale.getdefaultlocale()
self.locale = locale
def formatweekday(self, day, width):
@@ -537,7 +539,7 @@ class LocaleHTMLCalendar(HTMLCalendar):
def __init__(self, firstweekday=0, locale=None):
HTMLCalendar.__init__(self, firstweekday)
if locale is None:
- locale = locale.getdefaultlocale()
+ locale = _locale.getdefaultlocale()
self.locale = locale
def formatweekday(self, day):
@@ -658,9 +660,11 @@ def main(args):
parser.error("if --locale is specified --encoding is required")
sys.exit(1)
+ locale = options.locale, options.encoding
+
if options.type == "html":
if options.locale:
- cal = LocaleHTMLCalendar(locale=options.locale)
+ cal = LocaleHTMLCalendar(locale=locale)
else:
cal = HTMLCalendar()
encoding = options.encoding
@@ -676,7 +680,7 @@ def main(args):
sys.exit(1)
else:
if options.locale:
- cal = LocaleTextCalendar(locale=options.locale)
+ cal = LocaleTextCalendar(locale=locale)
else:
cal = TextCalendar()
optdict = dict(w=options.width, l=options.lines)