[ZPT] response.setHeader() best practice

Casey Duncan casey@zope.com
Mon, 08 Apr 2002 10:12:23 -0600


Perhaps it would be useful to consider implementing a TAL construct for 
manipulating the HTTP header. Perhaps even an implicit metal slot such as:

<metal:block fill-slot="http_header">
Content-Type: foo/bar
Some-Other-Header: baz
</metal:block>

-Casey

Florent Guillaume wrote:
> Harry Wilkinson  <harryw@nipltd.com> wrote:
> 
>>On Wednesday 03 April 2002 2:34 pm, Florent Guillaume wrote:
>>
>>><tal:block define="dummy python:response.setHeader('blah')" />
>>>
>>This seems out of place in a page template to me.  My impression of the 
>>'correct' way to use page templates was only to present data acquired from 
>>lower layers, and leave the function calls that are used as procedures (ie 
>>not using the return value as part of the presentation of the page) to Python 
>>scripts.
>>
>>Perhaps that's incorrect, or just unnecessarily purist.  Still, it doesn't 
>>seem to me like the kind of thing that ought to be in a page template.
>>
>>What do you think?
>>
> 
> 
> I'd agree with you for any other kind of function call, but setHeader
> is really a special case, it's *not* part of the application logic,
> and is really related to the presentation part.
> 
> Florent
>