[Zope] Reloading file objects?

Dieter Maurer dieter@handshake.de
Wed, 16 Aug 2000 20:53:51 +0200 (CEST)


Peter Arvidsson writes:
 > That just work for documents. It is not possible to set any headers for
 > pdf-files, is it? I tried to put that in the document I call the
 > pdf-file from but that didnt work.
The following DTML method (view) adds a header to a file/image:

<dtml-call "RESPONSE.setHeader('Expires',_.str(ZopeTime()-1))"
><dtml-var "PARENTS[0].index_html(REQUEST,RESPONSE)">


The "><" at the start of the second line may be necessary to
prevent spurious whitespace before the image.
Almost surely (not tested), you can use alternatively


Expires: <dtml-var "_.str(ZopeTime()-1)">

<dtml-var "PARENTS[0].index_html(REQUEST,RESPONSE)">


This uses Zope's CGI compatibility: the body of a response
generated by a DTML method (or document) may be preceeded
by a sequence of HTTP headers separated from the body by
a single blank line.


You would use this method in URLs in the following way:

	<URL to your image>/view


Dieter