[Zope-dev] Last-modified and bobobase_modification_time
Casey Duncan
casey@zope.com
14 Jun 2002 09:40:17 -0400
BTW: This list if for development *of* Zope, the zope@zope.org list is
better for questions bout developing *with* Zope.
On to your question:
There is no automatic way in which DTML can do this for you. This is
simply because <dtml-var foo> doesn't tell Zope what foo is. Is it a
document or a script that returns something different every time it is
called or something else? In fact foo might different things at
different times, if you aquire the template into different contexts.
Anyhow, if you really want to set a Last-Modified header that reflects
the latest of a group of documents, you can write a python script that
accepts either a list of names or objects to test. For the latter here's
a Py script named "setLastModTime" with a single argument, "*objects":
last_mod = objects[0].bobobase_modification_time()
for ob in objects[1:]:
last_mod = max(last_mod, ob.bobobase_modification_time())
context.REQUEST.RESPONSE.setHeader('Last-Modified', last_mod.rfc822())
return last_mod # for debugging purposes
Then from dtml:
<dtml-call expr="setLastModTime(this(), fooMethod, barDocument, ...)">
hth,
Casey
On Fri, 2002-06-14 at 00:10, Wei He wrote:
> Hi all,
>
> Say you have 1_html with only one line:
> <dtml-var 2_html>
>
> When you HEAD http://xxx/1_html, you get Last-Modified refelecting only
> the last modification time of 1_html, while most people is expecting it
> to be newer one of 1_html and 2_html.
>
> Does anyone know of a walk-around like using the max() of
> bobobase_modification_time().timeTime() on the document itself
> and all the componets it dtml-vared?
>
> Forgive my using of non-Zope terms, for I'm new to Zope/Python.
>
> Wei He
>
>
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope )