[Zope] FW: [Zope-PTK] Date Question

Bill Anderson bill@noreboots.com
Tue, 19 Sep 2000 22:19:01 -0600


Scott Burton wrote:
> 
> This is the correct list :)
> 
> ----------
> From: Scott Burton <scott@launchpoint.net>
> Date: Tue, 19 Sep 2000 14:27:46 -0700
> To: <zope-ptk@zope.org>
> Subject: [Zope-PTK] Date Question
> 
> OK, I have searched everywhere for the answer to this. It is quite simple
> but I can't seem to figure it out. All I want to do is iterate over
> cataloged objects(<dtml-in "Catalog(meta_type='object_type')">) and only
> show items who's bobobase_modification_date matches today's date.
> 
> I just can't figure out how to set the fmt="%d" in an if tag.


You shouldn't have to.
If Zope's DateTime has the today method, you culd do:
<dtml-in "Catalog(meta_type='object_type')">
  <dtml-if "_.DateTime.today < bobobase_modification_time">
    &dtml-title; was modified today.
  </dtml-if>
</dtml-in>

hmmm ... lemme see if it does ... nope.
Well, it works in python.
The other day (at a machine I don't have access too right now) I managed
to get mxDateTime in the namespace. If it would help, I'll try to post
what I did to get it done.


In the meantime, if you have mxDateTime installed, you should be able to
have an external method called "Today", that returns DateTime.today, and
compare as thus:

<code-untested>
-------------------------------------------------
<dtml-in "Catalog(meta_type='object_type')">
  <dtml-if "Today < bobobase_modification_time">
    &dtml-title; was modified today.
  </dtml-if>
</dtml-in>
-------------------------------------------------
</code-untested>

still-wishing-mxDateTime-was-available-in-Zope-ly y'rs Bill

--
Do not meddle in the affairs of sysadmins, for they are easy to annoy,
and have the root password.