[Zope-dev] Last-modified and bobobase_modification_time

Wei He hewei@mail.ied.ac.cn
Sun, 16 Jun 2002 22:28:43 +0800 (CST)


On Sun, 16 Jun 2002, Chris Withers wrote:

> > > BTW: This list if for development *of* Zope, the zope@zope.org list is
> > > better for questions bout developing *with* Zope.
> > > 
> > Thanks for your codes indeed. I posted it here because I thought only 
> > people have high developing skill care about whether their web 
> > pages are up-to-date to their readers and so care the HTTP Last-modified 
> > header. 
> 
> Why do you think that? Surely all zope users will care about this? ;-)
> Besides, that's not the point, re-read Casey's email more carefully...
> 

I don't think so. There are quite ofter a user should click CTRL and the 
refresh button to get the up-do-date page. This is because the 
Last-modified header not properly set. If DTML doesn't care about the 
modification time of it's code segments, it will definitely returns the
template's modification time although the contents are keep on changing.

My conclution is that if DTML doesn't do this or dosen't provide a simple 
way to do that, Zope may not care about the header at all. So dynamic webpage
authors with basic skill could never control it. Only people have developing
skill may do. Am I right?

Here is Casey's email:

> 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

No mater what foo is, there is surely a last modification time of foo.
If it is a document. that's easy. If it is a script, there should be a 
method like self.setLastModificationTime(scriptTime). This method should 
decide if scriptTime is newer than DTML document's own update time and set 
it if so. Then it's up to the script writer to call the method with the 
current time if he/she want to disable browser's caching function.

> 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.

What stops the main DTML document from knowing the last modification time 
of foo? 

In fact, Casey's script is just a walk-around. Script writers should 
manually create a list containing all code segments he/she dtml-vared.
(Sorry for using this phrase to express my disagreement on choosing 
dtml-var against dtml-include). It's a boring task if there are many 
nested code segments included.

I'm a PHP user for several years and I'm try to migrate part of my 
projects to Zope. Changing from PHP to DTML/Python is not a big deal. 
But I'm so used to the easy environment PHP provides coders. 

Wei He