[Zope] Zope, setlocale(), requests and traversal

Doyon, Jean-Francois jdoyon at NRCan.gc.ca
Fri Dec 15 08:38:31 EST 2006


setlocale() is a python thing.  It wraps a C library, and that function
setups an application wide environment (A bit like an environment
variable would ...) ... Which is why it's not thread safe.

Calling setlocale() in one thread will affect the entire zope instance,
across threads.  Setlocale() is used by Zope to set the locale in
etc/zope.conf.

I found my own way to work around it (see other messages in this
thread), though you're right, I didn't think of looking at the Zope 3
packages (I'm using Zope 2.10, so that should be an option for me).
Maybe I'll have a look now :)

J.F.

-----Original Message-----
From: Chris Withers [mailto:chris at simplistix.co.uk] 
Sent: December 15, 2006 2:24 AM
To: Doyon, Jean-Francois
Cc: zope at zope.org
Subject: Re: [Zope] Zope, setlocale(), requests and traversal

Doyon, Jean-Francois wrote:
> - I see the docs mention setlocale might not be threadsafe, since Zope
is threaded, anyone know the implications?

is setlocale a Zope or Python thing? I'm guessing the latter, which
might well mean you'll get unstuck under high load here..

Zoep 3 has very good locale support, I wonder how much of that could be
leveraged here?

cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the Zope mailing list