Zope REQUEST question
missive at frontiernet.net
Fri Apr 18 15:31:32 CEST 2003
In article <OG2dnWc4TKANfAOjXTWcrg at august.net>, Terry Hancock wrote:
> Okay, this is a little tricky to explain. This is technically a Zope
> question, but it has to do with programming products in Python.
> I'm doing a Forbidden Thing with a Zope product, which is overloading its
> __getattr__ function. It's a necessary Evil, though. ;-)
> And actually, it works really well, as far as it goes. It *is* a nightmare
> to debug, which is why I've moved nearly all of the code out of this part
> so it can be tested independently.
> Anyway, it turns out, I need to be able to access the REQUEST object
> from there (I'm trying to implement an HTTP_REFERER block).
> So far, I've tried:
> getattr(self, 'REQUEST')
> ObjectManager.__getattr__(self, 'REQUEST')
> which should do the same thing, except the ObjectManager.__getattr__
> is much safer (it's not recursive). I'm not sure why I thought that REQUEST
> would be an attribute of the object at this point, but I'm pretty sure I
> read this somewhere and didn't just think it up out of thin air. However,
> in this case at least, it's wrong -- these both give me attribute errors
> (at least my object returns "not found" which is what happens when you
> raise an attribute error from inside of __getattr__ -- other errors usually
> give you the traceback you'd normally expect).
> Does anyone have a better idea for how to get the REQUEST?
1) You really, really want to join the zope at zope.org mailing list. There are
some people there who can answer this question in a second. If you do
not like the high traffic, you can read the list through a mail-news
gateway like gmane.
2) How about self.REQUEST ?
More information about the Python-list