[Zope] Problem with alternate path and request

Fernando Martins fmartins at hetnet.nl
Tue Oct 21 17:05:47 EDT 2003


Thanks, Ian and Evan, for your replies,

Ian Bicking wrote:
> On Monday, October 20, 2003, at 02:37 PM, Fernando Martins wrote:
[...]
> > So, it is either a bug on the request object which contains the
> > attribute
> > HTTP_X_FORWARDED_FOR when it shouldn't (i.e., when the request went
> > from the
> > client straight to Zope). But maybe it should always have it.
> >
> > Or it is a bug in the "structure request" which doesn't display the
> > attribute even if it is there.
>
> I assume it was a design choice, and changing it would break backward
> compatibility.

I'm afraid I don't see the issue here. The way I see it, there is an
(undocumented?) inconsistency between __str__ and __getattr__ (which gave me
a bug). Does it make sense to have these virtual HTTP_* attributes? Why
would someone rely on it? Also, if I make a typo in say HTTP_C00KIE, I'm
getting a bug which could have been spotted imediately at the first run.

> I'd recommend just using tal:content="python:
> request.HTTP_X_FORWARDED_FOR or request.REMOTE_ADDR".
>

I had it already solved with request['HTTP_X_FORWARDED_FOR'] or
request['REMOTE_ADDR'] which I believe is the same, i.e. both should be
calling __getattr__, right?

Cheers,

Fernando




More information about the Zope mailing list