[ZCM] [ZC] 1755/ 3 Comment "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 17:17:17 EDT 2005
Issue #1755 Update (Comment) "Can't get to REQUEST from product code (Zope 2.8)"
Status Rejected, Zope/bug critical
To followup, visit:
http://www.zope.org/Collectors/Zope/1755
==============================================================
= Comment - Entry #3 by tseaver on Apr 13, 2005 5:17 pm
This is also the second acquisition-related bug reported today
against Zope 2.8a2 from somebody using the
PlacelessTranslationService. Is Lalo Martins still the
maintainer of PTS?
At any rate, PTS is maintained at:
http://plone.org/products/pts/
And it looks like Lalo's e-mail is linked there.
________________________________________
= Reject - Entry #2 by mcdonc on Apr 13, 2005 5:03 pm
Status: Pending => Rejected
This is a common problem and isn't really related to the code *inside* the class. It's related to other code that doesn't properly acquisition wrap the instance. IOW, the code you're showing us isn't the code that is broken; the problem lies in some other piece of code that unwraps the object (or rewraps it improperly) at a point where it needs to continue to rely on having a good acquisition context.
This isn't really a Zope bug, it's an application bug.
________________________________________
= 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