<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000066">
<font size="-1"><font face="Verdana">Hi,<br>
<br>
I just needed the same thing... here another way.<br>
<br>
Deleting Zope Objects in DTML based on timestamp.<br>
<br>
I created this for housekeeping of a file repository,very similar the
the File Library app in the Zope Examples. This dtml-method deletes
items of type "File" that haven't been modified in 45 days.<br>
<br>
Notice the syntax in the line: </font></font><font size="-1"><font
face="Verdana"> <dtml-call
expr="manage_delObjects([_['id'],])"><br>
<br>
I Google'd it, apparently its handing manage_delObjects a list of one
item, and that item is the item "id" from the current namespace. The
trailing comma is for a list of one item.<br>
<br>
To test it, I commented the manage_delObjects line, and included the
commented lines below, to test for the correct results.<br>
</font></font><font size="-1"><font face="Verdana"><br>
<br>
<dtml-with Files><br>
<dtml-in expr="objectItems('File')"
sort="bobobase_modification_time" reverse><br>
<dtml-with sequence-item><br>
<dtml-if expr="bobobase_modification_time()<=ZopeTime()-45"><br>
<!-- DEL: <dtml-var absolute_url><br> --><br>
<dtml-call expr="manage_delObjects([_['id'],])"><br>
<dtml-else><br>
<!-- KEEP: <dtml-var absolute_url><br> --><br>
</dtml-if><br>
</dtml-with><br>
</dtml-in><br>
</dtml-with><br>
<dtml-call "RESPONSE.redirect('filelist_html')"></font></font><br>
<small><font face="Verdana"><br>
Good Luck,<br>
<br>
-Jonathan Cyr<br>
</font></small><br>
<br>
<br>
Ausum Studio wrote:<br>
<blockquote cite="midBAY16-DAV38pGt0K8Wf0000a158@hotmail.com"
type="cite">
<pre wrap="">Look for the object DateTime in the help files of your Zope installation.
They have a nice set of methods to compare time dates.
Anyways, they all return false or true, so in your case I would convert the
time dates to integers, then perform a simple subtraction operation, and
check if the most recent date is greater to ...
seconds_in_a_day * 5.
Ausum
----- Original Message -----
From: "Laura McCord" <a class="moz-txt-link-rfc2396E" href="mailto:Laura.McCord@doucet-austin.com"><Laura.McCord@doucet-austin.com></a>
To: <a class="moz-txt-link-rfc2396E" href="mailto:zope@zope.org"><zope@zope.org></a>
Sent: Friday, May 14, 2004 4:10 PM
Subject: [Zope] DTML Method - delete files
I am almost done writing the script but I need to figure out how to
compare two dates. For instance, I have this: <dtml-var ZopeTime
fmt="%m/%d/%Y">
<dtml-var modification_date
fmt="%m/%d/%Y">
*** Now I need to compare the two dates to see if the ZopeTime is
greater by 5 days.
Any ideas on how to do that using dtml?
_______________________________________________
Zope maillist - <a class="moz-txt-link-abbreviated" href="mailto:Zope@zope.org">Zope@zope.org</a>
<a class="moz-txt-link-freetext" href="http://mail.zope.org/mailman/listinfo/zope">http://mail.zope.org/mailman/listinfo/zope</a>
** No cross posts or HTML encoding! **
(Related lists -
<a class="moz-txt-link-freetext" href="http://mail.zope.org/mailman/listinfo/zope-announce">http://mail.zope.org/mailman/listinfo/zope-announce</a>
<a class="moz-txt-link-freetext" href="http://mail.zope.org/mailman/listinfo/zope-dev">http://mail.zope.org/mailman/listinfo/zope-dev</a> )
_______________________________________________
Zope maillist - <a class="moz-txt-link-abbreviated" href="mailto:Zope@zope.org">Zope@zope.org</a>
<a class="moz-txt-link-freetext" href="http://mail.zope.org/mailman/listinfo/zope">http://mail.zope.org/mailman/listinfo/zope</a>
** No cross posts or HTML encoding! **
(Related lists -
<a class="moz-txt-link-freetext" href="http://mail.zope.org/mailman/listinfo/zope-announce">http://mail.zope.org/mailman/listinfo/zope-announce</a>
<a class="moz-txt-link-freetext" href="http://mail.zope.org/mailman/listinfo/zope-dev">http://mail.zope.org/mailman/listinfo/zope-dev</a> )
</pre>
</blockquote>
</body>
</html>