[MERGE] Before actually using encoding need to check that Python has corresponding codec (v.2)
Alexander Belchenko
bialix at ukr.net
Tue Jan 2 13:18:02 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Aaron Bentley пишет:
> Aaron Bentley has voted +1 (conditional).
> Status is now: Conditionally approved
> Comment:
> Nice work. I didn't realize how involved it would be.
>
> I'm pretty sure you don't need this line:
> #class FakeCodec
Actually, I want to
#/class FakeCodec
(it's my habit to mark end of complex python statements).
I'll remove this.
> Also, I think you want "Windows says "cp0" when there is no encoding)",
> not "Windows tell..." (The object of "tell" is the person being told.)
Hmm... I don't see such text in my patch.
Similar text was written by John Meinel:
# Windows returns 'cp0' to indicate there is no code page. So we'll just
# treat that as ASCII, and not support printing unicode characters to the
# console.
I think it's correct English.
> And when you override getpreferredencoding, shouldn't you set it back to
> the previous value at the end of the test?
Yes, I did. I copy approach of John Meinel from TestTerminalEncoding
where instead of self.tearDown() method is used self.addCleanup(self._reset).
I should admit that I don't completely understand difference between
.tearDown and ._reset, but I think it's related to problems with
test cleanup when error in test raised.
John, can you explain this moment?
So my cleanup for getpreferredencoding is inside
_reset method:
def _reset(self):
locale.getpreferredencoding = self._getpreferredencoding
sys.stderr = self._stderr
Do you satisfied with my explanations?
I don't want to resend the patch because only one thing I'll need to fix
is removing `#class FakeCodec` line.
Alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFmluKzYr338mxwCURAjD0AJ9afNRe3zylJ1nJJMHIjJtPox69fwCdECgy
4ohEXS2xfEwgfBXhHoyYTUY=
=pBqx
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list