[ZCM] [ZC] 1755/ 1 Request "Can't get to REQUEST from product code (Zope 2.8)"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Wed Apr 13 16:57:11 EDT 2005


Issue #1755 Update (Request) "Can't get to REQUEST from product code (Zope 2.8)"
 Status Pending, Zope/bug critical
To followup, visit:
  http://www.zope.org/Collectors/Zope/1755

==============================================================
= Request - Entry #1 by jdoyon on Apr 13, 2005 4:57 pm

I'm trying to get to the current REQUEST object from within some product code, and am not having any luck.

Apparently "self" (Where "self" is the instance of a persistent class) has an attribute called REQUEST, but it's a string that says: <Special Object Used to Force Acquisition> ...

So where I have this:

    def getCurrentLanguage(self):
        if hasattr(self, 'REQUEST') and self.REQUEST.get('HTTP_ACCEPT_LANGUAGE', None) in self.pathlocalizer.supported_languages:
            return self.REQUEST.get('HTTP_ACCEPT_LANGUAGE', None)
        else:
            return self.pathlocalizer.supported_languages[0]

I get told that "str" object doesn't have a "get" function/method.

Thanks,
J.F.



==============================================================



More information about the Zope-Collector-Monitor mailing list