On Tue, 17 Dec 2002 11:08:19 +0900
Yusei Tahara <[EMAIL PROTECTED]> wrote:

> > Probably os.environ.get('Z_SOMETHING') might be a better way than
> > locale.getlocale()[1], because using locale.getlocale()[1] means that
> > the behaviour of Zope will be changed implicitly, whereas
> > os.environ.get('Z_SOMETHING') is more explicit for the users, thus
> > less confusing..
> Nice idea.
> We can get environment value everywhere in Zope.
> it will be easy to make patch:-)
> +1

Zope 2.6.x has  LOCALE_ID in 'z2.py' to set locale value.
If LOCALE_ID is set to something, locale.getlocale()[1] is sure
to get this value, because locale.setlocale(locale.LC_ALL, val)
is called from 'z2.py'.

For this reason, if you set LOCALE_ID, locale.getlocale()[1] does not
mean that behaviour of Zope will be changed implicitly, but rather
explicitly, I think.

I'm not sure which is better;

1) adopting new environment value, Z_SOMETHING

2) using locale.getlocal()[1]
   needs some abstruction layer

> def getDefaultPythonCharEncodingName():
>     if os.name == 'posix':
>         return charEncodingMap.get(locale.getlocale()[1], 'latin1')
>     else:  # For MS Windows
>        return os.environ.get('Z_CHAR_ENCODING', 'latin1')

Any comments are welcomed.

Kazuya Fukamachi

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to