[Zope] Re: request.locale - do we have this in 2.9.4?

Philipp von Weitershausen philipp at weitershausen.de
Tue Sep 5 10:26:09 EDT 2006


Martijn Pieters wrote:
> On 9/5/06, Maciej Wisniowski 
> <maciej.wisniowski at coig.katowice.pl> wrote:
>> I'm using Zope 2.9.4 with Five1.4 (linux box).
>> I'm trying to use DateDisplayWidget (from
>> /zope/app/form/browser/textwidgets.py)
> [snip]
>> So is this something with my Zope that I don't have request.locale
>> or is that a bug?
> 
> I'd say it's a bug.

No it's not.

> The Zope3 request has the locale attribute, but the Zope2 request
> implementation doesn't.

Right. Who ever said that the Zope 2 request is compatible with the Zope 
3 request?

We can't even just make the Zope 2 request have that attribute because 
of potential backward incompatibilities. Why? Because you can do 
request.locale in Zope 2 right now which is an equivalent spelling of 
request['locale'] (it looks up request variables). If existing 
applications use the attribute access instead of the item access (which 
should clearly be the preferred way, but there's lots of Zope 2 legacy), 
they would break because request.locale would now find something else.

It's not a bug. It's Zope 2's obscenity with __getattr__ APIs instead of 
__getitem__ APIs that's preventing the harmonizing of the two 
implementations, that's all. Both the ObjectManager and the request are 
very good examples of how Zope 2 got this wrong, but Zope 3 got it right.

Philipp



More information about the Zope mailing list