[zope2-tracker] [Bug 1023722] [NEW] HTTPRequest.__getattr__() fails for key "locale" first time

kleist kleist at postkiosk.de
Thu Jul 12 04:27:06 UTC 2012


Public bug reported:

[copied from http://dev.plone.org/ticket/10875]

Quoting a succesful patch:

from ZPublisher.HTTPRequest import HTTPRequest, _marker

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:
            self.setupLocale()
        return self._locale
    v = self.get(key, default, returnTaints=returnTaints)
    if v is _marker:
        if key == 'debug':
            return self._debug
        raise AttributeError, key
    return v

HTTPRequest.__getattr__ = __getattr__

** Affects: zope2
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.
https://bugs.launchpad.net/bugs/1023722

Title:
  HTTPRequest.__getattr__() fails for key "locale" first time

To manage notifications about this bug go to:
https://bugs.launchpad.net/zope2/+bug/1023722/+subscriptions


More information about the zope2-tracker mailing list