[patch] encodings again

Robert Collins robertc at robertcollins.net
Fri Dec 23 04:56:42 GMT 2005


On Thu, 2005-12-22 at 17:05 -0600, John A Meinel wrote:
> 
> 
> PS> In case you missed the discussion, the current rule for the main
> branches (Robert & my integration branches, and probably bzr.dev) is
> that we need 2 people to review the change and give it +1. If someone
> else speaks up, I'll merge it into my integration branch. 

With one minor changes, +0


> +        if hasattr(sys.stdout, "encoding"):
> +            output_encoding = sys.stdout.encoding or
bzrlib.user_encoding
> +        else:

hasattr has problems - avoid it like measles.

if getattr(sys.stdout, "encoding", None):
    output_encoding = sys.stdout.encoding
else:
    output_encoding = bzrlib.user_encoding

Is both clearer and safer.


I'd really like a test for this - that the output_encoding gets
sys.stdout.encoding rather than bzrlib.user_encoding. With a test, +1.

Rob


-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051223/67a55d6f/attachment.pgp 


More information about the bazaar mailing list