[Zope-dev] Re: request.locale

Hanno Schlichting plone at hannosch.info
Sun Sep 16 13:20:53 EDT 2007


Philipp von Weitershausen wrote:
> Hanno Schlichting wrote:
>>
>> We already do something similar for the request.debug variable, but this
>> uses a stack frame hack which limits the debug attribute to be shown to
>> code in the zope.* packages.
>>
>> For the locale this is an undesired limitation as other code (like
>> plone.app.*) would like to use this as well.
>>
>> I'll try to implement a patch for this.
> 
> Thanks. I think you guys are on the right track.
> 
> Perhaps we can also sanitize the 'debug' issue at the same time? They
> should probably be treated equally.

I committed the change to Zope trunk now (r79698). As a nice side-effect
I could remove some code in Five's formlib support, which was only
working around the issue of the missing request.locale :)

As setting up the locale can be a bit slow sometimes (it parses a rather
large XML file in the end) I made the loading lazy, so it will only be
loaded when accessed first and not on creation of the request. This way
requests not needing it should not be slowed down.

Hanno



More information about the Zope-Dev mailing list