[ZPT] Re: [Zope] Problem with alternate path and request

Ian Bicking ianb at colorstudy.com
Sun Oct 19 21:55:56 EDT 2003


On Sunday, October 19, 2003, at 06:00 PM, Fernando Martins wrote:
>>>   <p tal:content="request/HTTP_X_FORWARDED_FOR |
>> request/REMOTE_ADDR"></p>
>>>
>>> doesn't work as expected: HTTP_X_FORWARDED_FOR returns an empty 
>>> string
>>> rather than failling in favor of REMOTE_ADDR.
>>
>> This means that something defined "HTTP_X_FORWARDED_FOR" even
>> when you did not use virtualisation.
>>
>> You know, that you can view the request with
>> '<p tal:content="structure request">'?
>>
>
> Yes, and I think it's a bug because it doesn't appear in the request.

If you want to confirm this, you should try to use 
container.REQUEST.HTTP_X_FORWARDED_FOR from a Python script, or maybe 
just tal:content="python: repr(request.HTTP_X_FORWARDED_FOR)" -- even 
though the request doesn't list that variable among its headers, it may 
still return a value for that attribute.  The only way to test if an 
attribute exists is to attempt to get the attribute.  Perhaps (I don't 
know) the request object returns "" for any HTTP_* attribute that is 
not found.

--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org




More information about the ZPT mailing list