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