Re: [issue10087] HTML calendar is broken

2011-08-12 Thread Senthil Kumaran
Hello Éric, I might have ignored some minor stylistic comments. The '.' in the help text and , after the last TestName, I am not sure if it is of concern. I think, to update the stylistic comments, if the submitters (if they care) could have updated the patch, or a separate commit on style change

[issue10087] HTML calendar is broken

2011-08-12 Thread Éric Araujo
Éric Araujo added the comment: There were comments by Ezio and me on Rietveld. Also, the commit adds a period after the help text for --encoding, but all other help text aren’t capitalized and don’t use periods, as is usual in help messages. -- __

[issue10087] HTML calendar is broken

2011-08-10 Thread Roundup Robot
Roundup Robot added the comment: New changeset 9fc7ef60ea06 by Senthil Kumaran in branch '3.2': Fix closes Issue10087 - fixing the output of calendar display in the html format. Patch by Chris Lambacher. Test Contributed by catherine. http://hg.python.org/cpython/rev/9fc7ef60ea06 New changese

[issue10087] HTML calendar is broken

2011-08-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le Mon, 08 Aug 2011 10:46:20 +, Senthil Kumaran a écrit : > > Antoine - I was specifically interested to know if > sys.stdout.buffer.write as in the patch was good(/proper) way to go > forward writing the bytes? Yes, it is. -- __

[issue10087] HTML calendar is broken

2011-08-08 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: -haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue10087] HTML calendar is broken

2011-08-08 Thread Senthil Kumaran
Senthil Kumaran added the comment: I agree with Chris's point that people using html format in console are probably redirecting to a file and encoding parameter should be helpful. What do we settle upon? Leave the encoding argument as such? Antoine - I was specifically interested to know if s

[issue10087] HTML calendar is broken

2011-08-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: I don't think "WARNING: this may corrupt your terminal" is warranted. Also, I think we can safely remove the --encoding option. Calling a module from the command-line is intended as a demonstration of the module's functionality, it's not an official API that

[issue10087] HTML calendar is broken

2011-08-07 Thread Chris Lambacher
Chris Lambacher added the comment: Senthil: I wasn't advocating the removal of the ability to specify encoding, only stating that avoiding the use of sys.stdout.buffer.write could only sensibly be done if we also removed the ability to specify an encoding (I can see how my wording might have

[issue10087] HTML calendar is broken

2011-08-06 Thread Senthil Kumaran
Senthil Kumaran added the comment: Chris, as you already suggested in msg124410, I would prefer the removal of encoding specification from command line. Providing the encoding argument via API with deprecating warning is a good idea. The output should be string and it should be just be printe

[issue10087] HTML calendar is broken

2011-08-06 Thread Chris Lambacher
Chris Lambacher added the comment: Senthil: I think that would fundamentally make things worse. The HTML calendar apparently always provides a bytes type, but lets assume it provided you with unicode and we used sys.stdout.write on the output. Fundamentally you would get the same behavior as

[issue10087] HTML calendar is broken

2011-08-06 Thread Ezio Melotti
Ezio Melotti added the comment: BTW, accessing sys.stdout.buffer is not really safe, because if sys.stdout has been replaced with some other object, the buffer attribute might not be available (IIRC StringIO doesn't have it). -- ___ Python tracker

[issue10087] HTML calendar is broken

2011-08-06 Thread Senthil Kumaran
Senthil Kumaran added the comment: FWIW, I think removing the encoding facility (more so because it can interfere with the terminal encoding) and just dealing with strings to output the html version of calendar seems a neater way than definiing write = sys.stdout.buffer.write and writing the

[issue10087] HTML calendar is broken

2011-08-01 Thread Éric Araujo
Éric Araujo added the comment: Patch looks good. I made a few very minor style comments on Rietveld (follow the “review” link). -- ___ Python tracker ___ _

[issue10087] HTML calendar is broken

2011-07-31 Thread R. David Murray
Changes by R. David Murray : -- nosy: +r.david.murray ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://ma

[issue10087] HTML calendar is broken

2011-07-30 Thread Catherine Devlin
Catherine Devlin added the comment: Very simplistic patch to test_calendar.py that adds a test for this fix. This fails on the unpatched trunk b/c the unpatched output begins with b"b'http://bugs.python.org/file22806/test_calendar_byteoutput.patch ___ Pytho

[issue10087] HTML calendar is broken

2010-12-20 Thread Ron Adam
Ron Adam added the comment: Oops. You're right. I miss understood how the encode method works in this particular case. ;-/ I agree with your comments as well. -- ___ Python tracker ___

[issue10087] HTML calendar is broken

2010-12-20 Thread Chris Lambacher
Chris Lambacher added the comment: Sorry in advance for the long winded response. Ron, have you looked at my patch? The underlying issue is that the semantics for print() between Python 1 and 3. print() does not accept a bytes type in Python 3. In Python 2 str was a "bytes" type and so print

[issue10087] HTML calendar is broken

2010-12-20 Thread Ron Adam
Ron Adam added the comment: The problem is in the following line... return ''.join(v).encode(encoding, "xmlcharrefreplace") The .encode(encoding, "xmlcharrefreplace") is returning a bytes object. Here is the simplest change to resolve the problem. return str(''.join(v).encode(encodin

[issue10087] HTML calendar is broken

2010-12-20 Thread Ron Adam
Changes by Ron Adam : -- nosy: +ron_adam ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org

[issue10087] HTML calendar is broken

2010-11-23 Thread Chris Lambacher
Chris Lambacher added the comment: I don't think we *need* to have the encoding in the HTML calendar, but I doubt we could remove it at this point, deprecate maybe, but since I don't use the module I don't have a sense for how often the need for encoding comes up. The one thing that the encod

[issue10087] HTML calendar is broken

2010-11-22 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I wonder: do we really need "encoding" option to the calendar output? It is really not the job of the calendar module to deal with encodings. The calendar module should produce text calendars as unicode strings and HTML calendars as UTF-8 bytes. If s

[issue10087] HTML calendar is broken

2010-11-22 Thread Chris Lambacher
Chris Lambacher added the comment: The test_pydoc method looks workable, but I'll need to come back to it later because I don't have any more time to work on it today. -- ___ Python tracker __

[issue10087] HTML calendar is broken

2010-11-22 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Mon, Nov 22, 2010 at 11:55 AM, Chris Lambacher wrote: .. > 1. Any suggestions about how to test the output of the console program (the > case that this bug affects) > would be appreciated. For month displays, a doctest may be most appropriate. See Li

[issue10087] HTML calendar is broken

2010-11-22 Thread Chris Lambacher
Chris Lambacher added the comment: I am attaching a new patch which fixes the majority of the comments raised. 1. Any suggestions about how to test the output of the console program (the case that this bug affects) would be appreciated. 2. Agreed, included in the output for --help 3. Agreed,

[issue10087] HTML calendar is broken

2010-11-22 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Mon, Nov 22, 2010 at 9:48 AM, Chris Lambacher wrote: .. > I don't understand what you mean by "elides the line breaks in output". It is actually not that bad: $ ./python.exe -m calendar -t html| wc -l 121 $ python2.7 -m calendar -t html| wc -l

[issue10087] HTML calendar is broken

2010-11-22 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue10087] HTML calendar is broken

2010-11-22 Thread Chris Lambacher
Chris Lambacher added the comment: I don't understand what you mean by "elides the line breaks in output". They are still there, you just don't see them as \n because print() is no longer implicitly converting the bytes to a string (which appears to actually result in a repr). -- __

[issue10087] HTML calendar is broken

2010-11-21 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: It may be acceptable, but your patch elides the line breaks in output. Can you add unit tests? -- ___ Python tracker ___ __

[issue10087] HTML calendar is broken

2010-11-21 Thread Chris Lambacher
Chris Lambacher added the comment: I have attached a patch that conditionally uses sys.stdout.buffer.write to output binary (encoded) data to stdout. -- nosy: +lambacck Added file: http://bugs.python.org/file19768/calendar_bytes_output.patch ___ Pyt

[issue10087] HTML calendar is broken

2010-11-21 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://m

[issue10087] HTML calendar is broken

2010-10-18 Thread Éric Araujo
Changes by Éric Araujo : -- nosy: +eric.araujo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue10087] HTML calendar is broken

2010-10-13 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Note that .decode(encoding) calls have been deliberately removed in py3k: see issue 3059. -- nosy: +georg.brandl, gpolo ___ Python tracker _

[issue10087] HTML calendar is broken

2010-10-13 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: There is a similar issue with printing text calendar with specified encoding: $ python3 -m calendar --encoding=utf8 b' 2010\n\n .. -- ___ Python tracker

[issue10087] HTML calendar is broken

2010-10-13 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Wed, Oct 13, 2010 at 12:20 PM, Walter Dörwald wrote: .. > Does the following patch fix your problems? > Probably not because with your patch print() will encode HTML stream with the system default encoding which may be different from that specified by

[issue10087] HTML calendar is broken

2010-10-13 Thread Walter Dörwald
Walter Dörwald added the comment: Does the following patch fix your problems? -- keywords: +patch nosy: +doerwalter Added file: http://bugs.python.org/file19217/calendar.diff ___ Python tracker ___

[issue10087] HTML calendar is broken

2010-10-13 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The issue is clearly with using print() for bytes' output: if len(args) == 1: print(cal.formatyearpage(datetime.date.today().year, **optdict)) I am not sure, however how this can be fixed because calendar interface allows user to sp

[issue10087] HTML calendar is broken

2010-10-13 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : $ python3 -m calendar --type=html 2010 Produces HTML which renders into the attached PDF file. It looks like bytes vs. strings issue. -- assignee: belopolsky components: Library (Lib) files: Calendar for 2010.pdf messages: 118532 nosy: belopo