summaryrefslogtreecommitdiffstats
path: root/Lib/calendar.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2011-08-11 01:22:52 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2011-08-11 01:22:52 (GMT)
commit962fed91018ab95f0fb5ec564b4543729e6aa5fc (patch)
tree5bf13de1ff70e6309791e75627f9725add0ed235 /Lib/calendar.py
parent77c4fd01dd3fa9b7830ca3dcd1506565352d32f3 (diff)
downloadcpython-962fed91018ab95f0fb5ec564b4543729e6aa5fc.zip
cpython-962fed91018ab95f0fb5ec564b4543729e6aa5fc.tar.gz
cpython-962fed91018ab95f0fb5ec564b4543729e6aa5fc.tar.bz2
Fix closes Issue10087 - fixing the output of calendar display in the html format. Patch by Chris Lambacher. Test Contributed by catherine.
Diffstat (limited to 'Lib/calendar.py')
-rw-r--r--Lib/calendar.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py
index 84aa3a4..0301d6b 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -636,7 +636,7 @@ def main(args):
parser.add_option(
"-e", "--encoding",
dest="encoding", default=None,
- help="Encoding to use for output"
+ help="Encoding to use for output."
)
parser.add_option(
"-t", "--type",
@@ -662,10 +662,11 @@ def main(args):
if encoding is None:
encoding = sys.getdefaultencoding()
optdict = dict(encoding=encoding, css=options.css)
+ write = sys.stdout.buffer.write
if len(args) == 1:
- print(cal.formatyearpage(datetime.date.today().year, **optdict))
+ write(cal.formatyearpage(datetime.date.today().year, **optdict))
elif len(args) == 2:
- print(cal.formatyearpage(int(args[1]), **optdict))
+ write(cal.formatyearpage(int(args[1]), **optdict))
else:
parser.error("incorrect number of arguments")
sys.exit(1)
@@ -687,9 +688,11 @@ def main(args):
else:
parser.error("incorrect number of arguments")
sys.exit(1)
+ write = sys.stdout.write
if options.encoding:
result = result.encode(options.encoding)
- print(result)
+ write = sys.stdout.buffer.write
+ write(result)
if __name__ == "__main__":