HTTPRequest.__getattr__() fails for key "locale" first time
Bug #1023722 reported by
kleist
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 2 |
Opinion
|
Undecided
|
Unassigned |
Bug Description
[copied from http://
Quoting a succesful patch:
from ZPublisher.
def __getattr__(self, key, default=_marker, returnTaints=0):
if key == 'locale':
# we only create the _locale on first access, as setting it
# up might be slow and we don't want to slow down every
# request
if self._locale is _marker:
return self._locale
v = self.get(key, default, returnTaints=
if v is _marker:
if key == 'debug':
return self._debug
raise AttributeError, key
return v
HTTPRequest.
To post a comment you must log in.
The patch changes behavior in a backwards incompatible way.
In Zope 2 you can have a normal value in the request (or request.form) by the key 'locale'. If you have such a key, the special locale object won't be accessible. We can change this behavior in a new major version like Zope 4 and give the special locale object precedence over normal values. But we cannot do that in a maintenance release.