Use of last_modified
I want to state at the bottom of all pages when the page was last modified. So, I put this line in my standard_html_footer in the root folder: <P>Last modified: <dtml-var last_modified> This results in a Zope Error: Zope Error Zope has encountered an error while publishing this resource. KeyError Sorry, a Zope error occurred. What did I do wrong? Better yet, how does one go about debugging such things? Sorry to ask silly questions, but you've got to start somewhere. Searches for "last_modified" in web resources and in the indices of printed documentation come up empty. -- | Don Porter dgporter@erols.com | | "Some days you just can't get rid of a bomb!" | | -- Adam West as BATMAN | |______________________________________________________________________|
Don Porter wrote:
I want to state at the bottom of all pages when the page was last modified. So, I put this line in my standard_html_footer in the root folder:
<P>Last modified: <dtml-var last_modified>
Your looking for, <dtml-var bobobase_modification_time> last_modified somehow got into the ZQR in the past. I've been going through the whole thing and saw that mistake, among other things, it'll be corrected in the next update. David, tone..
This results in a Zope Error:
Zope Error
Zope has encountered an error while publishing this resource.
KeyError
Sorry, a Zope error occurred.
What did I do wrong? Better yet, how does one go about debugging such things? Sorry to ask silly questions, but you've got to start somewhere. Searches for "last_modified" in web resources and in the indices of printed documentation come up empty.
-- | Don Porter dgporter@erols.com | | "Some days you just can't get rid of a bomb!" | | -- Adam West as BATMAN | |______________________________________________________________________|
_______________________________________________
<P>Last modified: <dtml-var last_modified>
On 3 Oct, David Kankiewicz wrote:
Your looking for, <dtml-var bobobase_modification_time>
Thanks. Now I don't feel quite so stupid. Hmmm. That's a step closer. Now I get a date, but it doesn't seem to correspond to the last modification time of any of the objects (index_html, standard_html_header, standard_html_footer, or any of the images) which make up the page. Is it taking an average? The formatting isn't right either: Last modified: 1999/10/03 13:38:8.30297 US/Pacific ^- Why "8" not "08" ? Also, is there a similar documentation problem with the "get_size" variable? -- | Don Porter dgporter@erols.com | | "Some days you just can't get rid of a bomb!" | | -- Adam West as BATMAN | |______________________________________________________________________|
At 02:50 4-10-99 , Don Porter wrote:
Hmmm. That's a step closer. Now I get a date, but it doesn't seem to correspond to the last modification time of any of the objects (index_html, standard_html_header, standard_html_footer, or any of the images) which make up the page. Is it taking an average?
It will only correspond to the last modification time of the called object. With DTML Documents and Files and such, that is the last modification time of any of the attributes of the object itself (so, any changes to the DTML, or the properties on the property sheet). It won't take into account any of the objects called from you method, like standard_html_header and -_footer. With DTML Methods, the story is even more complex. When a DTML Method is called, and it renderers it's DTML, its sense of 'self' is not the DTML Method object, but the object it is called upon, usually a Folder (wich is what index_html named DTML Methods are for, for example). So when the DTML calls a method like bobobase_modification_time, it's called on its parent, and so the modification time its parent is shown.
The formatting isn't right either:
Last modified: 1999/10/03 13:38:8.30297 US/Pacific
^- Why "8" not "08" ?
This I explained in my other email =).
Also, is there a similar documentation problem with the "get_size" variable?
get_size is a method only defined by DTML Method and DTML Document objects, but if you try and call it from a DTML Method, Zope will not find it, because the DTML Method object itself is not searched for the method. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | T: +31 35 7502100 F: +31 35 7502111 | mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ---------------------------------------------
At 23:11 3-10-99 , Don Porter wrote:
I want to state at the bottom of all pages when the page was last modified. So, I put this line in my standard_html_footer in the root folder:
<P>Last modified: <dtml-var last_modified>
This results in a Zope Error:
Zope Error
Zope has encountered an error while publishing this resource.
KeyError
Sorry, a Zope error occurred.
What did I do wrong? Better yet, how does one go about debugging such things? Sorry to ask silly questions, but you've got to start somewhere. Searches for "last_modified" in web resources and in the indices of printed documentation come up empty.
The HTML source of the returned error contains a traceback which is always handy with debugging. KeyError means it couldn't find any attribute by the name of last_modified. That's because it doesn't exist. Unfortunately, although many parts of Zope are getting better documentation, the methods and attributes of the Zope Object Framework are still very poorly documented, and only the source offers any help. The method you are looking for is called bobo_modification_time (the name is a historical one, don't ask =)). It'll return a DateTime object, and because you are including it in a DTML template with dtml-var, it will be stringified in a default, and probably for you incorrect way. You can tell the var tag to format it for you with the fmt attribute of the var tag, see the DTML guide for more details (and watch out for Appendix A, which gives you a list of DateTime formattings). -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | T: +31 35 7502100 F: +31 35 7502111 | mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ---------------------------------------------
participants (3)
-
David Kankiewicz -
Don Porter -
Martijn Pieters