<!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.&nbsp; 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">&nbsp;&nbsp;&nbsp;&nbsp; &lt;dtml-call
expr="manage_delObjects([_['id'],])"&gt;<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.&nbsp; 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>
&lt;dtml-with Files&gt;<br>
&lt;dtml-in expr="objectItems('File')"
sort="bobobase_modification_time" reverse&gt;<br>
&lt;dtml-with sequence-item&gt;<br>
&nbsp;&nbsp; &lt;dtml-if expr="bobobase_modification_time()&lt;=ZopeTime()-45"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- DEL: &lt;dtml-var absolute_url&gt;&lt;br&gt; --&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp; &lt;dtml-call expr="manage_delObjects([_['id'],])"&gt;<br>
&nbsp;&nbsp; &lt;dtml-else&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- KEEP: &lt;dtml-var absolute_url&gt;&lt;br&gt; --&gt;<br>
&nbsp;&nbsp; &lt;/dtml-if&gt;<br>
&nbsp; &lt;/dtml-with&gt;<br>
&lt;/dtml-in&gt;<br>
&lt;/dtml-with&gt;<br>
&lt;dtml-call "RESPONSE.redirect('filelist_html')"&gt;</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">&lt;Laura.McCord@doucet-austin.com&gt;</a>
To: <a class="moz-txt-link-rfc2396E" href="mailto:zope@zope.org">&lt;zope@zope.org&gt;</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: &lt;dtml-var ZopeTime
fmt="%m/%d/%Y"&gt;
                                  &lt;dtml-var modification_date
fmt="%m/%d/%Y"&gt;

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