[Zope] Simple DTML date-stamp

Peter Bengtsson peter@grenna.net
Thu, 10 Aug 2000 15:38:09 +0100


<dtml-var bobobase_modification_time> should do what you are after.
<dtml-var bobobase_modification_time fmt="%H:%M"> Should return 15:35 for
example.

Take a look at
http://www.zope.org/Members/AlexR/CustomDateFormats
for date and time formats.

I've had som problems with returning the modification date of the right
object if you do like this in standrard_html_footer

Use:
<dtml-with "_.string.split(URL,'/')[-1]">
Current page last modfified: <dtml-var bobobase_modification_time>
</dtml-with>

This should maybe be coupled together with a dtml-try or simply dtml-if, but
I haven't run into problems with it without.

> Just starting to set things up, and I would like a
> standard_html_footer with a date-stamp.
>
> As a start, I tried:
>
> <hr>
> <p>Last modified: <dtml-var name="date" fmt="aCommonZ"></p>
> <p><dtml-var ZopeAttributionButton></p>
> </body>
> </html>
>
> Why does this break?
> Minimal format breaks in the same way:
>
> <hr>
> <p>Last modified: <dtml-var date fmt=aCommonZ></p>
> <p><dtml-var ZopeAttributionButton></p>
> </body>
> </html>
>
>
> In either case, View generates:
>
> Zope Error
> Zope has encountered an error while publishing this resource.
>
> KeyError
>
> Sorry, a Zope error occurred.
>
> Traceback (innermost last):
>   File C:\Program Files\TotipotentZope\lib\python\ZPublisher\Publish.py,
> line 222, in publish_module
>   File C:\Program Files\TotipotentZope\lib\python\ZPublisher\Publish.py,
> line 187, in publish
>   File C:\Program Files\TotipotentZope\lib\python\Zope\__init__.py, line
> 221, in zpublisher_exception_hook
>     (Object: ApplicationDefaultPermissions)
>   File C:\Program Files\TotipotentZope\lib\python\ZPublisher\Publish.py,
> line 171, in publish
>   File C:\Program Files\TotipotentZope\lib\python\ZPublisher\mapply.py,
> line 160, in mapply
>     (Object: standard_html_footer)
>   File C:\Program Files\TotipotentZope\lib\python\ZPublisher\Publish.py,
> line 112, in call_object
>     (Object: standard_html_footer)
>   File C:\Program Files\TotipotentZope\lib\python\OFS\DTMLMethod.py,
> line 167, in __call__
>     (Object: standard_html_footer)
>   File C:\Program
> Files\TotipotentZope\lib\python\DocumentTemplate\DT_String.py, line 502,
> in __call__
>     (Object: standard_html_footer)
>   File C:\Program
> Files\TotipotentZope\lib\python\DocumentTemplate\DT_Var.py, line 276, in
> render
>     (Object: date)
> KeyError: date
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>