[Zope-dev] Re: request.locale

Hanno Schlichting plone at hannosch.info
Mon Sep 10 04:04:28 EDT 2007

Dieter Maurer wrote:
> Hanno Schlichting wrote at 2007-9-9 11:58 +0200:
>> ...
>> Obviously this needs a bit of rather hairy code
> Indeed, as you must not define 'locale' as a request attribute
> (it may hide 'locale' "set otherwise") but otherwise let it behave as if
> it were an attribute.

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.

But we are already overriding each an every access method on the request
(like __getattr__, __getitem__, ...) so stuffing some conditional code
in there should be possible.

I'll try to implement a patch for this.


More information about the Zope-Dev mailing list