Thanks Shawn for review.

On 06/27/12 03:41, Shawn Walker wrote:

local.getpreferredencoding() has some pitfalls. As a result, I think you're better of using the result of locale.getlocale()[1].

See this pages for details:

http://stackoverflow.com/questions/4082645/using-python-2-xs-locale-module-to-format-numbers-and-currency

The pydoc for getpreferredencoding() on docs.python.org also warns that the result is a "guess" at user preferences. So it seems like getlocale() is the better answer, especially as we've already called setlocale() at this point. But it would be nice to know for certain.

I chatted regarding pitfalls for local.getpreferredencoding() with Takeshi and they are when locale is changed in the program. If locale is changed in the program then local.getpreferredencoding() still returns the old encoding. I checked the source code, in pkg commands we set locale to the user’s default setting only and never change the locale. So it is safe to use local.getpreferredencoding() in pkg code.
Please let me know your opinion.


src/modules/client/history.py:
lines 107-109: I don't think we should have this here. Only the main program module should be setting locale information.

When pkg command is run pkg.client.api is imported as api. The api in turn imports pkg.client.history as history. During import the _() function should be available. If not
available then gets the error :

   NameError: name '_' is not defined

So I think the lines 107 to 109 which install _() function cannot be removed from
history.py file.


src/sign.py:
  update copyright

src/util/publish/pkgfmt.py:
  update copyright

src/util/publish/pkglint.py:
  update copyright

src/util/publish/pkgmogrify.py:
update copyright

Thanks for pointing. I have modified the copyright in my workspace.

Abhi.
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to